Skip to main content

Timeline for Bytes/Character

Current License: CC BY-SA 3.0

5 events
when toggle format what by license comment
Apr 19, 2023 at 18:48 comment added NoOneIsHere @ShadowRanger I'm surprised I'm still here 7 years later but you are right, I should have mentioned -1 byte in Python 2
Apr 19, 2023 at 14:36 comment added ShadowRanger @NoOneIsHere: That only works on Python 2, not Python 3; on Python 3, map produces a lazy iterator, not a list, so the return value would not show the lengths of anything. You'd need lambda x:[*map(len,map(str.encode,x))] or lambda x:[len(c)for c in map(str.encode,x)] to use map, and both of those would be longer than the listcomp in the answer.
Jun 23, 2016 at 21:04 comment added NoOneIsHere -1 byte: use map. lambda x:map(len,map(str.encode,x))
Jun 23, 2016 at 14:18 history edited atlasologist CC BY-SA 3.0
added 4 characters in body
Jun 23, 2016 at 14:11 history answered atlasologist CC BY-SA 3.0