推 mantour:TmpLine = split( strip( lines[idx] ) ) 03/16 20:21
→ mantour:改成 TmpLine = split( strip(lines[idx]) , "-" ) 03/16 20:21
→ mantour:試試看 03/16 20:22
→ uranusjr:看起來原本接受的格式應該是類似 2012 03 16 這樣 03/16 21:40
→ uranusjr:split 在沒有設定分隔符時預設的分隔符沒有包括 '-' 03/16 21:41
→ jet96344:m大我改了你的建議後還是有error 03/17 01:51
→ jet96344:invalid literal for int(): 01 5.3934554E 這是錯誤訊息 03/17 01:51
→ jet96344:是不是還需要改什麼才能讀 2001-01-01 <value>這種格式 03/17 01:52
推 mantour:多用一次split先把 2001-01-01和 <value> 分開即可 03/17 02:02
→ uranusjr:最簡單的改法:在 split 那行前面加一行 03/17 02:59
→ uranusjr:lines[idx] = lines[idx].replace('-', ' ', 2) 03/17 03:01
→ uranusjr:(當然效能上就不予置評) 03/17 03:01
推 mantour:或是用 TmpLine=re.split("\s|-",strip(lines[idx])) 03/17 11:01
→ ltroot:f = "%Y-%m-%d" 03/17 13:13
→ ltroot:t = time.strftime(f, time.localtime()) 03/17 13:13
→ ltroot:這樣呢@@? 03/17 13:14