Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jquery从发送到cherrypy的csv获取文件名?_Jquery_Python_Csv_Cherrypy - Fatal编程技术网

使用jquery从发送到cherrypy的csv获取文件名?

使用jquery从发送到cherrypy的csv获取文件名?,jquery,python,csv,cherrypy,Jquery,Python,Csv,Cherrypy,我正在使用pandas读取从jquery发送过来的.csv文件。用户将上传这些文件到我的网站,所以我不会提前知道文件名。在我的python代码中,是否有可能在这里提取文件名?这是我读取csv文件的cherrypy脚本 @cherrypy.expose def submit(self, myfile): cherrypy.session['myfile'] = myfile self.data = DataFrame(pd.read_csv(myfile.file))

我正在使用pandas读取从jquery发送过来的.csv文件。用户将上传这些文件到我的网站,所以我不会提前知道文件名。在我的python代码中,是否有可能在这里提取文件名?这是我读取csv文件的cherrypy脚本

@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

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