-1
我試圖在文件中寫:寫入文件Python,錯誤?
f = open('parsed.txt', 'w')
f.write(url + '\n' + title + '\n' + email + '\n\n')
,但我得到的錯誤:
Traceback (most recent call last):
File "C:/Users/Brand Cream/AppData/Local/Programs/Python/Python35/index.py", line 122, in parsePage
f = open('parsed.txt', 'w')
TypeError: open() takes 1 positional argument but 2 were given
有什麼不對?
你碰巧在你的代碼中擁有自己的'open'函數嗎? –
你有自己的函數'open()'或者你使用'from ... import *',它會覆蓋oryginal'open()'函數。 – furas