[Tutor] This is driving my crazy! My file hasn't been corrupted

Chris “Kwpolska” Warrick kwpolska at gmail.com
Sun Aug 31 20:44:40 CEST 2014


On Sun, Aug 31, 2014 at 6:31 PM, Richard Dillon <dillonrw at comcast.net> wrote:
> My text file has five numbers, 1-5
> I don't what the problem is.
> I've written the file using Word (saved as .txt ) as well as TextEdit
> Python 3.4.1 on a Mac

We don’t really know either, without seeing the file.  It probably has
some unwanted garbage produced by your fancy-schmancy editor.  Get a
real plain text editor (TextWrangler for example) and don’t use
rich-text editors.  With a real editor, your code works here.

Also, don’t do this:

>     except:
>         print('An error occured.')

It’s better to let Python show the exceptions.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense


More information about the Tutor mailing list