Skip to content

How to strip a list in Python?

list1 = ["a  ", "  b ", " c"]

[i.strip() for i in list1] # ['a', 'b', 'c']
See also  How to create multidimensional array in Python using numpy?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.