On Sun, 08 Mar 2015 04:59:56 +1100, Chris Angelico wrote: > On Sun, Mar 8, 2015 at 4:50 AM, Marko Rauhamaa <ma...@pacujo.net> wrote:
>> Correct. Linux pathnames are octet strings regardless of the locale. >> >> That's why Linux developers should refer to filenames using bytes. >> Unfortunately, Python itself violates that principle by having >> os.listdir() return str objects (to mention one example). > > Only because you gave it a str with the path name. If you want to > refer to file names using bytes, then be consistent and refer to ALL > file names using bytes. As I demonstrated, that works just fine. Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> type(os.listdir(os.curdir)[0]) <class 'str'> -- https://mail.python.org/mailman/listinfo/python-list