python 讀取CSV檔案
import csv # 開啟CSV檔案 with open('example.csv', 'r', newline='') as file: reader = csv.DictReader(file) # 遍歷CSV檔案的每一行(作為字典) for row in reader: print(row['Name'], row['Age'], row['City'])
########################
python 讀取CSV檔案
import csv # 開啟CSV檔案 with open('example.csv', 'r', newline='') as file: reader = csv.DictReader(file) # 遍歷CSV檔案的每一行(作為字典) for row in reader: print(row['Name'], row['Age'], row['City'])
########################