On 4/9/2013 10:29, Ferrous Cranus wrote: > Στις 4/9/2013 3:38 μμ, ο/η Dave Angel έγραψε: >> 'file' isn't magic. And again, it doesn't look at the filename, it >> looks at the content. > So, you are saying that it looks a the content of the file and not of > what encoding we used to save the file into?
That's right. There's no place where your text editor stores the encoding it used, so 'file' has to guess, based only on the content. > > But the contents have within: > > f.write(b'\xb6\xe3\xed\xf9\xf3\xf4\xef\xfc\xed\xef\xec\xe1 > \xf3\xf\xf3\xf4\xde\xec\xe1\xf4\xef\xf2\n') > > so it should have said greek-iso and not ascii. > No, that line is totally ASCII. Only when it's EXECUTED by Python will a non ASCII byte string object be created. Like I said, 'file' doesn't know the first thing about Python syntax, nor should it. -- Signature file not found -- https://mail.python.org/mailman/listinfo/python-list