[Tutor] file questions

spir denis.spir at free.fr
Wed Nov 25 10:22:59 CET 2009


Hello,

1) encoding guess
From the library manual:
file.encoding
    The encoding that this file uses. When Unicode strings are written to a file, they will be converted to byte strings using this encoding. In addition, when the file is connected to a terminal, the attribute gives the encoding that the terminal is likely to use (that information might be incorrect if the user has misconfigured the terminal). The attribute is read-only and may not be present on all file-like objects. It may also be None, in which case the file uses the system default encoding for converting Unicode strings.
How can python do that?

2) time stamp
How to read it (found no attr in "file" type)? (If possible in platform independant manner, and as datetime object.)

Denis
________________________________

la vita e estrany

http://spir.wikidot.com/




More information about the Tutor mailing list