0
我正在接近這個項目的結束,我再次被卡住了。到目前爲止,程序從網址提取的具體數據,我已經得到它分離的數據和元數據知道我需要做的事情,但datatime.datatime.strptime提取日期
我不知道什麼或如何,數據我所居住這裏是1500線是我與說明書給出了幾個
USGS 14211720 2017-01-30 19:15 PST 28600 P 6.26 P
USGS 14211720 2017-01-30 19:30 PST 30400 P 6.17 P
USGS 14211720 2017-01-30 19:45 PST 38300 P 6.03 P
source site # date discharge stage level
部分碼是
import datetime
# define empty lists, we will append the data to them
dateList = []
dischargeList = []
stagelevelList = []
for line in dataLines:
# use 'datatime.datatime.strptime()' to extract date
#use the '.strip()' and float() functions to convert values
print (dateList)
print("we have {} items in the date list".format(len(dateList)))
print("we have {} items in the discharge list".format(len(dischargeList)))
print("we have {} items in the velocity list".format(len(stagelevelList)))
所以我加入了date_obj線,並增加了一個dateList .append(線)和我沒有定義DATE_STR和dateList是空的,我需要補定義文件的所有三個或什麼都自己被從1400行列表中的數據調用,但我只需要在每個列中放置特定的列 –