util_fileio.py 234 B

12345678910
  1. import os
  2. def write_file(file, file_dir):
  3. if not os.path.exists(file_dir):
  4. os.makedirs(file_dir)
  5. file_path = file_dir + "/" + file.name
  6. with open(file_path, 'wb') as f:
  7. f.write(file.read())
  8. f.close()