寻找将显示"13-Aug"并且意味着2013年8月的excel公式.我理想地希望将"13-Aug"单元格复制到右侧的11个单元格,每次增加月份和适当的年份,所以它看起来像:
"13-Aug","13-Sep",......,"13-Dec","14-Jan","14-Feb"
我试图通过使用请求和全局将本地驱动器上的文件夹中的所有文件发布到某个Web URL.每次我将新文件发布到URL时,我想在字典中添加一个新的"键值"项,即"文件名(密钥),在POST文件后输出服务器(值)":
import requests, glob, unicodedata
outputs = {}
text_files = glob.iglob("/Users/ME/Documents/folder/folder/*.csv")
url = 'http://myWebsite.com/extension/extension/extension'
for data in text_files:
file2 = {'file': open(data)}
r = requests.post(url, files=file2)
outputs[file2] = r.text
Run Code Online (Sandbox Code Playgroud)
这给了我错误:
Traceback (most recent call last):
File "/Users/ME/Documents/folder/folder/myProgram.py", line 15, in <module>
outputs[file2] = r.text
TypeError: unhashable type: 'dict'
Run Code Online (Sandbox Code Playgroud)
这是因为(我认为)"file2",如果是'dict'类型.无论如何,在我将它发送到文件名的字符串之后,是否要转换/更改'file2' ?
我正在运行 Windows 并尝试在 C# 中加载本地文件(给定文件路径)。我希望读取文件的类型为System.IO.Stream.
我尝试使用StreamReader sr = new StreamReader("Path_To_File.csv")但它没有用..
C# 中的什么方法会做到这一点?