在python中获取我的电话目录

问题描述:

我将Android手机连接到Windows笔记本电脑.在Windows资源管理器中,我的照片所在的目录是:

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\

在python中,我这样做:

In python I do:

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

我得到:

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

到目前为止,我最好的方法是在android设备上启用大容量存储,然后python可以看到它.但我不想不必这样做.因此,请保持开放性.

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.

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