作者DuBank (鍍銀)
看板PttEarnMoney
標題[發錢] 程設伸手牌
時間Tue Dec 18 23:25:37 2018
這邊應該不少會python的人 QQ
(這篇先發1f)
# Write a function to read a CSV file with ',' as delimiter and returns a
list of records.
# The function must be able to ignore ',' that are within a pair of double
quotes '"'.
def csvReader(filename):
records = []
for line in open(filename):
line = line.rstrip("\n") # strip '\n'
if line=='':
continue # ignore empty line
else:
records.append(line)
return records
雙引號去不掉,該怎麼辦呢?
(語言應該是python2)
最快幫我解決問題的微薄 1000p QQ
(最晚到明天早上10:00)
題目網址: (需登入)
http://www.pyschools.com/quiz/view_question/s13-q8
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.237.13.100
※ 文章網址: https://www.ptt.cc/bbs/PttEarnMoney/M.1545146742.A.14B.html
※ 編輯: DuBank (36.237.13.100), 12/18/2018 23:28:55
推 Timekeeper: 推 1.200.215.147 12/18 23:29
→ Timekeeper: 收到感謝 1.200.215.147 12/18 23:30
→ mazz: 阿,還沒學到python欸XD 1.174.227.110 12/18 23:54
推 bruce0v0: 推個 118.150.196.5 12/19 00:17