What's the working directory when using IDLE?

前端 未结 4 441
无人共我
无人共我 2020-12-08 01:13

So, I\'m learning Python and would like to create a simple script to download a file from the internet and then write it to a file. However, I am using IDLE and have no idea

4条回答
  •  不思量自难忘°
    2020-12-08 01:28

    Here is an excerpt from usfca.edu

    If you want to be able to import your files easily in IDLE, you need to make sure the working directory for IDLE is set to the folder with all of your code. For example, my in-class code is located at the directory /Users/sjengle/Desktop/Code, so to change the working directory of IDLE I need to run the following two commands:

    import os
    os.chdir("/Users/sjengle/Desktop/Code")
    

提交回复
热议问题