I want to get a file path by python.
My file is in C:\Users\user1\OneDrive\Desktop\Python\test.py
when I using below code , the result is 'C:\Users\user1', cannot get the real path of the file
import os
apath=os.getcwd()
print(apath)
C:\Users\user1
I want to get a file path by python.
My file is in C:\Users\user1\OneDrive\Desktop\Python\test.py
when I using below code , the result is 'C:\Users\user1', cannot get the real path of the file
import os
apath=os.getcwd()
print(apath)
C:\Users\user1
Hi @HeHaiYun-5343, this tag small-basic-featured-program is for Small Basic programming language, not python... I recommend you to add the not-supported tag or an appropriate tag. Thanks. By the way, are you using Visual Studio?
Thank you for your reminding and reply.
And do you mean VS code? if it is, then yes.
1 Person is following this question.