Python高階應用9

python 第九課 python的高階應用對數據的處理


import csv

filename = 'sitka_weather_07-2014.csv'
with open(filename) as f:
     reader = csv.reader(f)
     header_row = next(reader)
     print(header_row)

with open(filename) as f:
    reader = csv.reader(f)
    headr_row = next(reader)

    for index, column_header in enumerate(header_row):
            print(index, column_header)
#提取並讀取數據 首先讀取每天的最高氣溫:
with open(filename) as f:
    reader = csv.reader(f)
    header_row = next(reader)

    highs = []
    for row in reader:
        highs.append(row[1])
    print(highs)

文件文件下載地址 http://download.csdn.net/download/wang1018960145/10167710 


接下來會有pythonweb開發文章

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章