📌  相关文章
📜  如何在 python 代码示例中从 USB 从 android 设备中提取图像

📅  最后修改于: 2022-03-11 14:45:40.082000             🧑  作者: Mango

代码示例1
import os
import shutil

#path
path = "'Deze pc'/'HUAWEI Mate 10 lite'/'Interne opslag'"

# List files and directories
# in '/home/User/Documents'
print("Before copying file:")
print(os.listdir(path))

#Source path
source = "C:/Users/Tim/PycharmProjects/project1/testfile.jpg"

# Print file permission
# of the source
perm = os.stat(source).st_mode
print("File Permission mode:", perm, "\n")

# Destination path
destination = "'Deze pc'/'HUAWEI Mate 10 lite'/'Interne opslag'/photos"

# Copy the content of
# source to destination
dest = shutil.copy(source, destination)

# List files and directories
# in "/home / User / Documents"
print("After copying file:")
print(os.listdir(path))

# Print file permission
# of the destination
perm = os.stat(destination).st_mode
print("File Permission mode:", perm)

# Print path of newly
# created file
print("Destination path:", dest)