Python ValueError:时间数据';结束日期';与格式不匹配';%m/%d/%Y';
我正在尝试将日期转换为时间戳 我正在从csv及其内容读取数据Python ValueError:时间数据';结束日期';与格式不匹配';%m/%d/%Y';,python,csv,Python,Csv,我正在尝试将日期转换为时间戳 我正在从csv及其内容读取数据 CID,End Date,License Key bcc1,3/11/2022,abc 我的主要功能如下所示 with open(sys.argv[1],'r') as file: csvfile= csv.reader(file,delimiter=",") for row in csvfile: CID = row[0] DATE = st
CID,End Date,License Key
bcc1,3/11/2022,abc
我的主要功能如下所示
with open(sys.argv[1],'r') as file:
csvfile= csv.reader(file,delimiter=",")
for row in csvfile:
CID = row[0]
DATE = str(row[1])
END_DATE = datetime.datetime.strptime(DATE,"%m/%d/%Y").timetuple()
# END_DATE= datetime.datetime(int(END_DATE)).strftime('%s')
EVAL_SKU_LIST = row[2]
print CID
print (DATE)
print EVAL_SKU_LIST
我听到一个错误,说
ValueError:时间数据“结束日期”与格式“%m/%d/%Y”不匹配
日期的值是多少?上述CSV中提到的2022年3月11日跳过第一行。代码试图解释标题行值?是的,就是这样。日期?2022年11月3日的值是多少?如上所述的CSV中的值跳过第一行。代码试图解释标题行值?是的,就是这样。有没有办法区分标题和内容?有没有办法区分标题和内容? CID,End Date,License Key bcc1,3/11/2022,abc
csvfile = csv.reader(file, delimiter=",")
headers = next(csvfile) # read one row
for row in csvfile: # iterate over all subsequent rows
# ...