【问题标题】:Get file name from csv sent to cherrypy with jquery?使用jquery从发送到cherrypy的csv中获取文件名?
【发布时间】:2013-11-10 11:25:04
【问题描述】:

我正在使用 pandas 读取从 jquery 发送过来的 .csv 文件。用户会将这些文件上传到我的网站,因此我不会提前知道文件名。是否可以在我的 python 代码中的某个位置提取文件名?这是我读取 csv 文件的樱桃脚本。

@cherrypy.expose
def submit(self, myfile):

    cherrypy.session['myfile'] = myfile

    self.data = DataFrame(pd.read_csv(myfile.file))

    data_html = data_to_html(self.data)

    return data_html

【问题讨论】:

    标签: jquery python csv cherrypy


    【解决方案1】:

    我相信您可以使用myfile.filename 访问文件名。如果您使用 dir(myfile) 检查 myfile 对象,您应该会看到它有很多类似的方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-14
      • 2014-05-22
      • 1970-01-01
      • 2023-03-27
      • 1970-01-01
      • 1970-01-01
      • 2016-12-10
      • 1970-01-01
      相关资源
      最近更新 更多