Why?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NoName

    #1

    Why?

    # -*- coding: cp1251 -*-
    from glob import glob

    src= "C:\\0000\\îÏ×Á Ñ ÐÁÐËÁ\\*.*"
    print glob(src)





    ['C:\\0000\\\xcd \xee\xe2\xe0\xf f \xef\xe0\xef\xe a\xe0\\ksdjfk.t xt', 'C:
    \\0000\\\xcd\xe e\xe2\xe0\xff \xef
    \xe0\xef\xea\xe 0\\\xeb\xfb\xe2 \xee\xe0\xeb\xe e\xe0\xeb.txt']

    Why not "C:\\0000\\îÏ×Á Ñ ÐÁÐËÁ\\ksdjfk.t xt" and etc?

  • John Machin

    #2
    Re: Why?

    On Feb 6, 11:32 am, "NoName" <zaz...@gmail.c omwrote:
    # -*- coding: cp1251 -*-
    from glob import glob
    >
    src= "C:\\0000\\îÏ×Á Ñ ÐÁÐËÁ\\*.*"
    print glob(src)
    >
    ['C:\\0000\\\xcd \xee\xe2\xe0\xf f \xef\xe0\xef\xe a\xe0\\ksdjfk.t xt', 'C:
    \\0000\\\xcd\xe e\xe2\xe0\xff \xef
    \xe0\xef\xea\xe 0\\\xeb\xfb\xe2 \xee\xe0\xeb\xe e\xe0\xeb.txt']
    >
    Why not "C:\\0000\\îÏ×Á Ñ ÐÁÐËÁ\\ksdjfk.t xt" and etc?
    Search this newsgroup for "glob unicode"

    Comment

    • Gabriel Genellina

      #3
      Re: Why?

      En Mon, 05 Feb 2007 21:32:23 -0300, NoName <zaz600@gmail.c omescribió:
      # -*- coding: cp1251 -*-
      from glob import glob
      >
      src= "C:\\0000\\Но вая папка\\*.* "
      print "src=",src
      print "repr(src)=",re pr(src)
      print glob(src)
      for fn in glob(src):
      print fn
      >
      >
      >
      >
      >
      ['C:\\0000\\\xcd \xee\xe2\xe0\xf f \xef\xe0\xef\xe a\xe0\\ksdjfk.t xt', 'C:
      \\0000\\\xcd\xe e\xe2\xe0\xff \xef
      \xe0\xef\xea\xe 0\\\xeb\xfb\xe2 \xee\xe0\xeb\xe e\xe0\xeb.txt']
      >
      Why not "C:\\0000\\Но вая папка\\ksd jfk.txt" and etc?
      glob returns a list; when you print a list, it uses repr() on its
      elements. It *looks* strange, but has the right contents. See the above
      modifications.

      --
      Gabriel Genellina

      Comment

      • NoName

        #4
        Re: Why?

        thanx a lot!!


        On 6 æÅ×., 12:04, "Gabriel Genellina" <gagsl...@yahoo .com.arwrote:
        En Mon, 05 Feb 2007 21:32:23 -0300, NoName <zaz...@gmail.c omescribio:
        >
        # -*- coding: cp1251 -*-
        from glob import glob
        >
        src= "C:\\0000\\îÏ×Á Ñ ÐÁÐËÁ\\*.*"
        >
        print "src=",src
        print "repr(src)=",re pr(src)print glob(src)
        >
        for fn in glob(src):
        print fn
        >
        >
        >
        ['C:\\0000\\\xcd \xee\xe2\xe0\xf f \xef\xe0\xef\xe a\xe0\\ksdjfk.t xt', 'C:
        \\0000\\\xcd\xe e\xe2\xe0\xff \xef
        \xe0\xef\xea\xe 0\\\xeb\xfb\xe2 \xee\xe0\xeb\xe e\xe0\xeb.txt']
        >
        Why not "C:\\0000\\îÏ×Á Ñ ÐÁÐËÁ\\ksdjfk.t xt" and etc?
        >
        glob returns a list; when you print a list, it uses repr() on its
        elements. It *looks* strange, but has the right contents. See the above
        modifications.
        >
        --
        Gabriel Genellina

        Comment

        Working...