I have a list of numbers in Python all with a extra space in the front. How do I remove the extra space (so that only the numbers are left)? A short example is below (note
For your case, with a list, you can use str.strip()
l = [x.strip() for x in List]
This will strip both trailing and leading spaces. If you only need to remove leading spaces, go with Alex' solution.
map(str.strip, List)
or
map(lambda l: l.strip(), List)
Use str.lstrip here, as the white-space is only at the front:
List = [s.lstrip() for s in List]
# ['5432', '23421', '43242', ...]
Or in this case, seeing as you know how many spaces there are you can just do:
List = [s[1:] for s in List]