我使用穿梭包向TeamSites.below读写excel文件是相同的代码:
从Teamsite读取文件
from shuttle import sharepoint, rfs
with rfs.open(TS, 'Reports/Weekly/Python_Datasets/fcs.csv','r') as remote_file:
fcs1=pd.read_csv(remote_file)
如何从Teamsite读取同一文件的最后修改日期和时间。
累得像下面一样,犯了错误:
from shuttle import sharepoint, rfs
with rfs.open(TS, 'Reports/Weekly/Python_Datasets/fcs.csv','r') as remote_file:
fcs1=os.path.getmtime(remote_file)
错误:
TypeError: coercing to Unicode: need string or buffer, instance found
我在这里做错什么了?
谢谢
发布于 2018-04-13 07:23:35
经过一番研究,我找到了我问题的答案。希望它能帮助其他人:
轮询函数列表将打印以下文件的所有元数据信息,这是我使用的语法:
dt1=TS.list('Reports/Monitoring/Forecast/file.csv')
这是列表格式,将其转换为json并读取json。
dt1=pd.read_json(json.dumps(dt1)).TimeLastModified
这为sharepoint/Teamsite上的文件提供了最后一个模糊的时间戳。
希望这能有所帮助。
发布于 2018-04-08 22:28:03
您从rfs.open(xxx)
获得了一个类似文件的对象,它不是getmtime
所需的字符串或缓冲区。
见https://docs.python.org/3.6/library/os.path.html#os.path.getmtime。
https://stackoverflow.com/questions/49726043
复制相似问题