Skip to content

Instantly share code, notes, and snippets.

@xxiz
Created January 16, 2023 06:51
Show Gist options
  • Save xxiz/3416f5388047384b1a497c068efe490b to your computer and use it in GitHub Desktop.
Save xxiz/3416f5388047384b1a497c068efe490b to your computer and use it in GitHub Desktop.
read file to memory
@app.route('/upload', methods=['POST'])
def upload():
file = request.files['file']
file_contents = file.read().decode() # read the contents of the file and decode it to a string
file_like_object = io.StringIO(file_contents)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment