我以以下方式使用 csv 模块
header = '"Id","IsDeleted","MasterRecordId","Salutation","FirstName","LastName","Name","Type","RecordTypeId","ParentId","BillingStreet","BillingCity","BillingState","BillingPostalCode","BillingCountry","BillingLatitude"'
header_c = csv.reader(header, delimiter=',', quotechar='"')
names = []
for row in header_c:
names.append(row)
检查名称返回:
[['Id'], ['', ''], ['IsDeleted'], ['', ''], ['MasterRecordId'], ['', ''], ['Salutation'], ['', ''], ['FirstName'], ['', ''], ['LastName'], ['', ''], ['Name'], ['', ''], ['Type'], ['', ''], ['RecordTypeId'], ['', ''], ['ParentId'], ['', ''], ['BillingStreet'], ['', ''], ['BillingCity'], ['', ''], ['BillingState'], ['', ''], ['BillingPostalCode'], ['', ''], ['BillingCountry'], ['', ''], ['BillingLatitude']]
我可以忽略所有奇数条目,保留 0、2、4,....,但我不明白我做错了什么以及为什么将逗号保留为条目。我必须更改什么才能删除逗号。'IsDeleted' 应该是第二个条目(名称 [1])
提前致谢。