我有这个清单:
input_list = ["1.2.3.4", " 2.3.4.5", " 3.4.5.6"]
我想在第二个单词中删除那个空格......我该怎么办?
我尝试过:
for x in input_list:
x.strip(" ")
和:
for x in input_list:
x.replace(" ","")
答案 0 :(得分:1)
your_list = [element.strip() for element in your_list]