Currently, I tried to use open()
to load files in python, but
Python returned an error saying that such a file did not exist.
Save the text file as test.txt on your desktop and
f=open("test.txt", "r", encoding="utf-8")
↑ I entered it like this, but it doesn't seem to work.
>>importos
>>os.getcwd()
'/Users/GTO'
Is there any possible cause?
Do I need to set up a working directory?
I'm stuck with the basics, so
I would appreciate it if you could reply.
For example, the desktop is /Users/Username/Desktop
for Windows.
Below /Users/Username
.
Try moving the file to the /Users/Username
directory.
Right-click the file on the target user's desktop → If you look at the property, the desktop directory path is written in the "Location" area.
© 2024 OneMinuteCode. All rights reserved.