【发布时间】:2019-03-04 16:53:59
【问题描述】:
我开始学习python。我想知道如何拆分有两个分隔符的列表。
输入
1,2,3,4,5;2
我的代码:
with open(path, 'r') as f:
for fs in f:
ip= fs.rstrip('\n').split(',')
print (ip)
我的输出:
['1', '2', '3', '4', '5;2']
期望的输出
['1', '2', '3', '4', '5', '2']
请问现在如何删除列表中的分号。
谢谢
【问题讨论】:
标签: python python-3.x python-2.7 python-requests