如果可能的话,有谁能告诉我如何拆分列表吗。想一个字一个字地把它分开。在
我的列表包含以下链接:
['14th_century;15th_century;16th_century;Pacific_Ocean;Atlantic_Ocean;Accra;Africa;Atlantic_slave_trade;African_slave_trade']
现在,我想用分裂的方法,把14世纪和15世纪分开,所以是2个单词,以此类推。在
所以对于每一个符号“;”它应该把它分开。在
现在我做了一个for循环。在
^{pr2}$更新:
到目前为止已经做到了。在
links = []
for line in newPath:
links.append(line[3:4])
old_list = []
new_list = []
old_list = links
new_list = old_list[0].split(';')
print new_list
您只需:
您只需:
示例
^{pr2}$相关问题 更多 >
编程相关推荐