手机和电脑用数据线连接好,怎样才能用python读取手机中的文件

手机和电脑用数据线连接好,怎样才能用python读取手机中的文件,我试了直接给路径,报错了,不能识别

这个的话,首先开启adb调试功能,然后可以使用python中的subprocess模块,直接模拟执行adb命令来获取,如下:
import subprocess

获取手机中的文件

file_path = '/Download/example.txt'
command = f'adb pull {file_path} >D:file.txt'
subprocess.run(command, shell=True)