![]() |
Syntax Error when running code - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Syntax Error when running code (/thread-17206.html) |
Syntax Error when running code - codeman - Apr-02-2019 Hi guys I am working on a LP problem using PuLP, Pandas and Plotly. When I run the code this error message popped up( I include the code). My suspicion is I may have inadvertently changed something small whilst inserting my data. It is a downloaded file that I run in Jupyter Notebook: file "<python-input-2-ea571e8e083e>", line 7 \=[.[.[pp,ooiiujname,("city","country,","lat,","long") SyntaxError: unexpected character after line continuation character( points to the last closed bracket after " long") RE: Syntax Error when running code - perfringo - Apr-02-2019 Too little information, but \ is line continuation character.From PEP8: Quote:The preferred way of wrapping long lines is by using Python's implied line continuation inside parentheses, brackets and braces. Long lines can be broken over multiple lines by wrapping expressions in parentheses. These should be used in preference to using a backslash for line continuation. with open('/path/to/some/file/you/want/to/read') as file_1, \ open('/path/to/some/file/being/written', 'w') as file_2: file_2.write(file_1.read()) RE: Syntax Error when running code - codeman - Apr-02-2019 Ok. I will have to check it later when on my personal laptop. Is there nothing untoward immediately noticeable i.e. after the continuation character ? RE: Syntax Error when running code - codeman - Apr-02-2019 Hi all Unless I am not searching the correct sources - as a newcomer to Python with the intent on upskilling as fast as reasonable possible - I have been looking for tutorials on PuLP. Reason is I am doing a lot of Linear Problem solving ( Python was proposed as the best). Apart from one meaningful video on You tube , I have been unsuccessful to source others. Please direct me to PuLP tutorial ( video and otherwise) that can assist me. Also additional Python models I am not aware of , with a strong leaning towards LP. Thanks |