廖秀穎python讀取CSV
import csv #輸入csv套件comma separated value
file = open('SPY.CSV','r',encoding='utf-8') #打開下載的檔案SPY.CSV,模式是r讀取,
csvreader = csv.reader(file) #將檔案讀入變數csvreader
header, rows = [], [] #宣告空白串列(陣列,清單)
header = next(csvreader) #串列header儲存檔案第一列
for row in csvreader: #檔案接續逐列附加append於rows串列
rows.append(row)
file.close() #關閉檔案
print(header)
print('廖秀穎分析列數:',len(rows))#視窗放大按下CTRL +

期中考有影片!https://11217133d.blogspot.com/2026/04/h1background-colorpinkcolorwhitetext.html
回覆刪除https://11217133d.blogspot.com/2026/04/4-16-2026.html
https://11217133d.blogspot.com/2026/04/pythoncsv.html
期中考有影片!https://11217133d.blogspot.com/2026/04/h1background-colorpinkcolorwhitetext.html
回覆刪除https://11217133d.blogspot.com/2026/04/4-16-2026.html
https://11217133d.blogspot.com/2026/04/pythoncsv.html
https://11217133d.blogspot.com/2026/03/excelpythoncsvmatplotlib-3-12-2026.html