Opening a file that has been uploaded in Flask

后端 未结 2 1435
余生分开走
余生分开走 2020-12-22 00:00

I\'m trying to modify a csv that is uploaded into my flask application. I have the logic that works just fine when I don\'t upload it through flask.

import p         


        
2条回答
  •  伪装坚强ぢ
    2020-12-22 00:27

    Answering my own question in case someone else needs this.

    FileStorage objects have a .stream attribute which will be an io.BytesIO

    f  = request.files['data_file']
    df = pandas.read_csv(f.stream)
    

提交回复
热议问题