SyntaxFix
Write A Post
Hire A Developer
Questions
You can use lists comprehensions:
strip_list = [item.strip() for item in lines]
Or the map function:
map
# with a lambda strip_list = map(lambda it: it.strip(), lines) # without a lambda strip_list = map(str.strip, lines)