[Tutor] problem in opening files
Steven D'Aprano
steve at pearwood.info
Mon Jun 25 01:54:20 CEST 2012
Craig Cesareo wrote:
> Be sure your current working directory is your desktop.
>
> import os
> print os.getcwd()
Be careful about changing the working directory from *within* Python. While
you can do so, and in the hands of somebody who knows what they're doing it is
perfectly fine, there are some pitfalls to avoid and you should consider it an
advanced technique.
But reading the WD with os.getcdd() is perfectly fine.
--
Steven
More information about the Tutor
mailing list