generating a CSV file online on Google App Engine

前端 未结 3 1584
甜味超标
甜味超标 2021-02-09 22:36

I am using Google App Engine (python), I want my users to be able to download a CSV file generated using some data from the datastore (but I don\'t want them to download the who

3条回答
  •  无人共我
    2021-02-09 23:09

    import StringIO
    
    tmp = StringIO.StringIO()
    writer = csv.writer(tmp)
    
    writer.writerow(["foo", "foo,bar", "bar"])
    contents = tmp.getvalue()
    
    tmp.close()
    print contents
    

提交回复
热议问题