open() function python default directory

后端 未结 7 1443
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-05 00:23

I\'m new and I have no idea where the default directory for the open() function is.

For example open(\'whereisthisdirectory.txt\',\'r\')

7条回答
  •  耶瑟儿~
    2021-01-05 00:51

    create the .txt file in the directory where u have kept .py file(CWD) and run the .py file.

提交回复
热议问题