【发布时间】:2020-06-30 17:26:50
【问题描述】:
从下面的 csv 中提取
1,'Chaks, Raj','$300,000', False
2,'Chen, Joe','$250,000', False
3,'Kumar, Harry','$240,000', True
我正在遍历列表,第一个列表在下面
M = ['1', "'Chaks", " Raj'", "'$300", "000'", ' False']
代码如下
for i in M:
empid = i[0]
print (empid)
name = row[1].replace(',','').replace('$','') if row[1] else '-'
print (name)
salary = row[3].replace(',','').replace('$','') if row[3] else 0
print ('salary',salary)
预计结束
1
Chaks Raj
300000
【问题讨论】: