[英]Access file and read/write from shared/network folder using python
i want to read and write data from.network folder, so far i have tried os.open("\u drive path"), open("\u drive path") but it says accesss or permission denied but when i use os.startfile("\u drive path")我想从 .network 文件夹读取和写入数据,到目前为止我已经尝试过 os.open("\u drive path"), open("\u drive path") 但它说访问或权限被拒绝但是当我使用 os .startfile("\u盘路径")
I always try r strings when connecting to a.network drive (especially if using pandas) try doing this to put the file into a dataframe连接到网络驱动器时,我总是尝试 r 字符串(尤其是使用熊猫时)尝试这样做以将文件放入 dataframe
import pandas as pd
desired_file = r'\\networkdrive\folder\file.csv'
df = pd.read_csv(desired_file, , encoding='utf-8')
This makes it easier for us to just look at as people with the r string but if you use这使我们更容易将其视为具有 r 字符串的人,但如果您使用
print(desired_file)
You can see that python reads it the way that it needs to be formatted for pandas您可以看到 python 以需要为 pandas 格式化的方式读取它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.