即時通訊!將文本文件轉換爲Python中的列表
我有一個文本文件是這樣的:
dates sampletime occupancy SActivities SPresence KhPresence AuPresence CarloPresence
04/05/2015 00:00:00 1430690400 0 0 0 0 0 0
04/05/2015 00:30:00 1430692200 0 0 0 0 0 0
04/05/2015 01:00:00 1430694000 0 0 0 0 0 0
04/05/2015 01:30:00 1430695800 0 0 0 0 0 0
04/05/2015 02:00:00 1430697600 0 0 0 0 0 0
04/05/2015 02:30:00 1430699400 0 0 0 0 0 0
04/05/2015 03:00:00 1430701200 0 0 0 0 0 0
04/05/2015 03:30:00 1430703000 0 0 0 0 0 0
04/05/2015 04:00:00 1430704800 0 0 0 0 0 0
04/05/2015 04:30:00 1430706600 0 0 0 0 0 0
04/05/2015 05:00:00 1430708400 0 0 0 0 0 0
04/05/2015 05:30:00 1430710200 0 0 0 0 0 0
04/05/2015 06:00:00 1430712000 0 0 0 0 0 0
04/05/2015 06:30:00 1430713800 0 0 0 0 0 0
04/05/2015 07:00:00 1430715600 0 0 0 0 0 0
04/05/2015 07:30:00 1430717400 0 0 0 0 0 0
04/05/2015 08:00:00 1430719200 0 0 0 0 0 0
04/05/2015 08:30:00 1430721000 0 0 0 0 0 0
04/05/2015 09:00:00 1430722800 0 0 0 0 0 0
04/05/2015 09:30:00 1430724600 0 0 0 0 0 0
04/05/2015 10:00:00 1430726400 1 0 0 1 0 0
04/05/2015 10:30:00 1430728200 1 0 0 1 0 0
04/05/2015 11:00:00 1430730000 1 0 0 1 0 0
04/05/2015 11:30:00 1430731800 1 0 0 1 0 0
04/05/2015 12:00:00 1430733600 1 0 0 1 0 0
04/05/2015 12:30:00 1430735400 1 0 0 1 0 0
04/05/2015 13:00:00 1430737200 1 0 0 1 0 0
04/05/2015 13:30:00 1430739000 2 1 1 1 0 0
04/05/2015 14:00:00 1430740800 3 1 1 1 0 0
04/05/2015 14:30:00 1430742600 4 1 1 1 0 1
04/05/2015 15:00:00 1430744400 2 1 1 1 0 0
我想檢索數據從分配給相應的列自動與其他文件第二行開始。我怎樣才能做到這一點?
例:
Spresence=['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',...]
太謝謝你了!
您必須顯示迄今爲止已有的代碼,以便其他人可以幫助您。否則,沒有辦法給你一個建議。 –
atleast至少你可以嘗試自己做一些事情... – PYPL