1

On Windows if i use MKS toolkit shell, os.getcwd() function returns value in lower case. However on using windows cmd, it returned exact path.

Is it possible in Python by any means for os.getcwd() to return the exact path (without converting to lower case on Windows)?

sarbjit
  • 3,786
  • 9
  • 38
  • 60

2 Answers2

3

Are you sure about this behavior? It's not documented, seems counter-intuitive, and I'm not able to reproduce it (on Windows 7 using Python 2.7.2):

>>> import os
>>> print os.getcwd()
C:\Users\foofoofoo

Note the capital characters at the start.

unwind
  • 391,730
  • 64
  • 469
  • 606
  • Actually i am using mks toolkit shell, on cmd window. it worked fine. Thanks, i'll edit my question – sarbjit Jul 20 '12 at 12:52
0

Before starting Python and using os.getcwd(), in your console you probably used "cd c:\your_path". It matters if this 'c' is lower or upper.

bitman
  • 547
  • 2
  • 6
  • 23