這篇文章主要介紹了解決Python3錯誤:SyntaxError:?unexpected?EOF?while?parsin問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
Python錯誤SyntaxError: unexpected EOF while parsing
含義是
解釋器到底了都沒找到它要找到的東西文章源自四五設(shè)計網(wǎng)-http://www.wasochina.com/39183.html
出現(xiàn)以上錯誤,仔細檢查代碼后還是沒有找到錯誤文章源自四五設(shè)計網(wǎng)-http://www.wasochina.com/39183.html
一般是以下原因
1 語法有問題,一般都是少了print最后的一個括號,我當時碰到是因為print(d.drop()少打了一個括號,別盲目的相信自動補全自己認真檢查一下,肯定這行代碼少了或者多了東西,希望有用。文章源自四五設(shè)計網(wǎng)-http://www.wasochina.com/39183.html
2 輸入語法肯定有問題,有時候忘了切換中英文輸入法,可以刪除了重新輸入文章源自四五設(shè)計網(wǎng)-http://www.wasochina.com/39183.html
python調(diào)試器pdb執(zhí)行多行語句報錯
*** SyntaxError: unexpected EOF while parsing (<stdin>, line 1)文章源自四五設(shè)計網(wǎng)-http://www.wasochina.com/39183.html
1 2 3 4 5 6 7 8 9 10 11 12 | (Pdb) a = [ 1 , 2 , 3 , 4 ] (Pdb) for i in a: * * * SyntaxError: unexpected EOF while parsing (<stdin>, line 1 ) (Pdb) import code (Pdb) code.interact(local = locals ()) >>> for i in a: ...???? print i ... 1 2 3 4 |
完成后,使用Ctrl-D返回到常規(guī)PDB提示符。文章源自四五設(shè)計網(wǎng)-http://www.wasochina.com/39183.html
以上為個人經(jīng)驗,希望能給大家一個參考。文章源自四五設(shè)計網(wǎng)-http://www.wasochina.com/39183.html 文章源自四五設(shè)計網(wǎng)-http://www.wasochina.com/39183.html


評論