Wednesday 15 May 2013

unicode - Python opening a hebrew path to file and using glob with hebrew -


I have a root directory in Hebrew and Hebrew has a file name. I want to do the following:

  fullPath = os.path.join (dirName, fileName) f = file (full path)   

and also wish me To find all Excel files starting with Hebrew prefix:

  excelpath = os.path.join (dirName, "% s * .xlsx"% hebrewPrefix), glob in fn For Glob (excelpath): Print FN   

How do I get it?

This works as expected of Japanese (assuming I have a folder one ¯ ¯ in which the file ¸¸¸? Ç ç ????. Xls ):

  Python 2.6.6 (r266: 84292, December 26, 2010, 22:31:48) [GCC 4.4.5] For more information on Linux2, type "help", "copyright", "credit" or "license" & gt; & Gt; & Gt; Import OS & gt; & Gt; & Gt; Flowerpath = OS. Path.join ("one word" ???? one ?? ¡one ??? ¯ "," ¸¸¸ ?? ç ????. ") & Gt; & gt; Gt; Import Globe & gt; & gt; Fn to glob.glob (fullpath): ... print FN ... one single ???? one ?? ¡one? ¯ / Ƹ¸ ?? ç ???? .xls   

You should not have any problem in Hebrew. Only problem will be when UTF-8 is not supported for your file system file names.

No comments:

Post a Comment