我遇到问题,找不到路径MTP设备
当我尝试这个脚本它给我一个错误
raceback (most recent call last):
File "C:\Users\BSHR\Desktop\Fire HD10 2019 Bootless\file.py", line 11, in <module>
os.replace(source,destination)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\\BSHR\\Desktop\\Fire HD10 2019 Bootless\\1.img' -> 'MTP:\\Fire\\Internal storage\\1xx.img'
import os
source = "C:\\Users\\BSHR\\Desktop\\Fire HD10 2019 Bootless\\1.img"
destination = "MTP:\\Fire\\Internal storage\\xx.img"
try:
if os.path.exists(destination):
print("file already")
else:
os.replace(source,destination)
print(source+" was moved")
except FileNotFoundError:
print(source+" was not found")
通过MTP将文件1.img传输到
1条答案
按热度按时间oprakyz71#
有两种方法。
这样,Python就可以像访问其他文件系统一样访问Android上的文件。