-1

hi I am getting a csv file in a api and getting in this function like :

def download_file(account_id, user_id, payload):
    print(file_name)
    file_path = '/tmp/test.csv'
    payload
    print(payload)

I want to download this file in this path . in payload I am getting this csv file . and want to store at this path file_path = '/tmp/test.csv'

sajjad ahmad
  • 13
  • 1
  • 6

1 Answers1

-1

you can open a writable file handle with the open function

def download_file(account_id, user_id, payload):
    file_path = '/tmp/test.csv'
    with open(file_path, 'w') as f:
        f.write(payload)
vinzenz
  • 669
  • 3
  • 14