python - Delete spaces from items in a list -


this question has answer here:

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

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -