简体   繁体   English

使用 python 从 shared.network 文件夹访问文件和读/写

[英]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.

相关问题 使用Python从网络文件夹读取文件/向网络文件夹写入文件/共享? - Read/Write a file from/to network folder/share using Python? Python:网络文件的并发访问(读/写) - Python: concurrent access (read/write) of network file 使用 Python,如何访问 windows 网络上的共享文件夹? - Using Python, how can I access a shared folder on windows network? 我需要怎么做才能将.csv文件写入共享网络文件夹? (树莓派和Python) - What do I need to do to write a .csv file to a shared network folder? (Raspberry Pi & Python) 使用 Python 从共享的 Google 驱动器文件夹中读取多个 csv - Read multiple csv from Shared Google drive folder using Python Python - 从文件夹读取文件并以格式写入 CSV 文件 - Python - Read files from folder and Write CSV file in format Python中网络共享文件夹的listdir - listdir of a network shared folder in Python 如何使用Python将共享的网络文件设置为只读? - How do you make a shared network file read-only using Python? 如何使托管在 PCF 中的 python 代码从网络共享驱动器读取 excel 文件 - How to make my python code that is hosted in PCF to read excel file from network shared drive Python从文件读取和写入'ß' - Python read and write 'ß' from file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM