Getting my phone directory in python

删除回忆录丶 提交于 2021-02-08 07:03:34

问题


I connect my android phone to my windows laptop. In windows explorer the directory where my photos are is:

Computer\GT-I9100\Phone\DCIM\Camera\

In python I do:

phone_dir="Computer\GT-I9100\Phone\DCIM\Camera"
os.listdir(phone_dir) 

I get:

FileNotFoundError: [WinError 3] The system cannot find the path specified: 'Computer\\GT-I9100\\Phone\\DCIM\\Camera\\*.*'

Edit: The best I have got so far is to enable mass storage on the android device and then python can see it. But I'd prefer not to have to do this. So will keep question open.


回答1:


phone_dir = os.path.join('Computer', 'GT-I9100', 'Phone', 'DCIM', 'Camera')


来源:https://stackoverflow.com/questions/17422858/getting-my-phone-directory-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!