#讀入一個已經存在的csv檔案: customer.csv #方法1:缺點,無法指定印出:第二筆記錄的公司名稱(因為都是純文字,不是陣列或串列list) a1 = open('customer.csv','rt',encoding='utf-8') txt = a1.read() print(txt) a1.close() #方法2:import csv模組,然後用with open('customer.csv','rt',encoding='utf-8')as fin: import csv with open('customer.csv','rt',encoding='utf-8')as fin: rows = csv.reader(fin,delimiter=',') #指定印出:第二筆記錄的公司名稱 listrow = list(rows) print(listrow[1][1]) for i in listrow: print(i)