【Django】postリクエストで送られてきたCSVファイルの処理

def import_csv(request):
    if request.method == 'POST' and request.FILES['myfile']:
        myfile = request.FILES['myfile']

        # Read csv file InMemoryUploadedFile
        file = myfile.read().decode('utf-8-sig')
        reader = csv.DictReader(io.StringIO(file))

        data = [line for line in reader]

Django,python

Posted by Next-k