Why os.getcwd returns "/" instead of "/storage/emulated/0/qpython/personal_directory"?

瀏覽次數:21 次
跳到第一則未讀訊息

Jean-Louis Subra

未讀,
2018年7月3日 清晨7:24:392018/7/3
收件者:QPython
Hi,

Another question. It's not convenient to write all the path because it's not always the same on different devices. Then I use the same under-tree in all devices and start from it. For example, I have "qpython/EPG/Progs" and "qpython/EPG/Data". I can read files in "Data" from "Progs" without writing the path from "/" to "EPG".

But if I can use with Python Windows commands :
- "os.getcwd()" which gives "C:\Users\Jean-Louis\Documents\EPG",
- "os.path.dirname (os.getcwd())" which gives "C:\Users\jean-louis\Documents\EPG\Progs",
I have only "/" with these 2 commands with QPython.

Can you explain why?

Thank you.
Jean-Louis
回覆所有人
回覆作者
轉寄
0 則新訊息