python - Delete spaces from items in a list -
this question has answer here:
- delete space values in list 3 answers
i have list:
input_list = ["1.2.3.4", " 2.3.4.5", " 3.4.5.6"]
and i'd remove space in second e third words... how can do?
i tried with:
for x in input_list: x.strip(" ")
and with:
for x in input_list: x.replace(" ","")
your_list = [element.strip() element in your_list]
Comments
Post a Comment