1
我想要做的事,如:龍捲風:讀取上傳的CSV文件?
import csv
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def post(self):
uploaded_csv_file = self.request.files['file'][0]
with uploaded_csv_file as csv_file:
for row in csv.reader(csv_file):
self.write(' , '.join(row))
但是,uploaded_csv_file
是file
型沒有。
這裏的最佳做法是什麼?
來源:
- http://docs.python.org/2/library/csv.html
- http://docs.python.org/2/library/functions.html#open
- https://stackoverflow.com/a/11911972/242933