Author Options:

How do I overwrite the python3 code? Answered

Hi, when I try to copy and paste the final code from the python3 IDLE to the python2 IDLE and run it, it comes up with an error message saying "Non-ASCII found, yet no encoding declared. Add a line like # -*- coding: utf-8 -*- to your file. Choose OK to save this file as utf-8." and gives me two opptions "Ok" or Edit my "file". Is this the proper error message and how do I overwrite the python3 code? If I choose "Edit my file" and try to add the line of code, it still wont let me save the file and comes up with the same error message. If I choose "Ok", when I try to run the file again, it comes up with an invalid syntax error message about the first quotation mark in the "published" line. Why does this happen and how can I solve this?

1 Replies

bekathwiaBest Answer (author)2017-07-20

It's about the plaintext representation of quotes, nothing to do with python3. Some text editors will automatically convert a plain single quote to a "smart quote" (nonplaintext character). Either try from the source file again, or replace your single quotes with fresh ones from your keyboard.

Select as Best AnswerUndo Best Answer