Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6037555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:05:29+00:00 2026-05-23T06:05:29+00:00

I have two distincts files called: ‘╠.txt’ and ‘¦.txt’ Such simple code: files =

  • 0

I have two distincts files called:

‘╠.txt’ and ‘¦.txt’

Such simple code:

files = os.listdir('E:\pub\private\desktop\')
for f in files:
    print f, repr(f), type (f)

which would return

¦.txt '\xa6.txt' <type 'str'>
¦.txt '\xa6.txt' <type 'str'>

I don’t get why I am getting the code 0xA6 for the ╠ character instead of OxCC.
I have been trying to play arround with the encode-decode methode but without success.
I have noticed that sys.getfilesystemencoding() is set mbcs – but I can’t manage to change it something like cp437.

Any help is very much appreciated.
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:05:30+00:00Added an answer on May 23, 2026 at 6:05 am

    You have to pass a unicode string to os.listdir and Python will return unicode filenames:

    # a string that is unicode+raw (escapes \)
    path = ur"E:\pub\private\desktop"
    print os.listdir(path)
    # [u'\xa6.txt', u'\u2560.txt']
    

    Windows NT actually uses unicode for filenames, but I guess Python tries to encode them when you pass a encoded path name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have two folders with approx. 150 java property files. In a shell script, how
I have two files client.php and server.php. The client file send a HTTP request
I have the following code that populates two drop down lists, it all works
Should be kind of trivial but say I have two jar files in libA.jar
I have two distinct files, myguide.fig (and its corresponding mygui.m) which contains the definition
I have two distinct (no inheritance) interfaces: IInvestable and IPricable and two classes: IndexClass
I have two distinct scenarios. One, where there is a many to many case,
I have a clojure/ring project that has two distinct app/handlers running on different ports
I have this little problem. My client wanted two distinct swf on a web
I have these two queries to test my output SELECT DISTINCT( providerId ), SUM((

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.