gpt4 book ai didi

python - 如何在 Python 中访问我的 iPhone 文件(通过 USB)?

转载 作者:行者123 更新时间:2023-12-05 08:12:45 25 4
gpt4 key购买 nike

我有一部 iPhone 通过闪电转 USB 数据线连接到我的电脑。它在“这台电脑”下显示为一个设备,我可以从中复制文件。我想使用 Python 自动执行此操作,但尝试访问“This PC”作为路径不起作用。

import os

path = r"This PC\Apple iPhone\Internal Storage"
for entry in os.listdir(path):
print(entry)
Traceback (most recent call last):
File "C:\test.py", line 4, in <module>
for entry in os.listdir(path):
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'This PC\\Apple iPhone\\Internal Storage'

有人说 F:\驱动器是保存设备文件的驱动器,但 iPhone 不会将自己注册为驱动器。

如何找到 iPhone 的绝对路径并访问其文件?我希望在 Python 中提供建议,但任何建议都可以。

最佳答案

恐怕我真的不明白这个问题,但据我所知,您只想访问不是 C: 的驱动器。您必须找出它是哪个驱动器,例如 F:。之后,您可以像访问“本地”文件一样访问文件。

f = open(r"F:\iPhonePictures\CuteCats\foo.txt")

如果这是您的问题,r 前缀允许您在字符串中使用转义字符: LTS

关于python - 如何在 Python 中访问我的 iPhone 文件(通过 USB)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53062138/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com