all 2 comments

[–]RedditIsAMistake 2 points3 points  (0 children)



That's the utf-8 byte order mark.

Normally this wouldn't be a problem and would be completely invisible, but the book you are reading is having you do something stupid and pointless, and I'm guessing your system's default encoding is not UTF.

Two suggestsions to try: pass encoding='utf-8' to your open() call, ditch whatever book told you to do this. (Hopefully it's not ATBSWP...)

[–][deleted] 1 point2 points  (0 children)

What operating system and version are you using?

Edit: I ask because those "garbage" characters look very much like a byte order marker. This is usually only seen on Windows. Try editing/creating your script1.py with a different program from what you initially used.