Skip to content

Instantly share code, notes, and snippets.

@jamescalam
Created June 10, 2021 19:29
Show Gist options
  • Save jamescalam/b3160fdd71b9fb13346d5ce8c825faec to your computer and use it in GitHub Desktop.
Save jamescalam/b3160fdd71b9fb13346d5ce8c825faec to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.0"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python3",
"display_name": "Python 3.10.0 64-bit",
"metadata": {
"interpreter": {
"hash": "0af001259c9085d3649b2fae0bd6b291d17df5c9f127f6973a1b7698b4048c39"
}
}
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"with (open('file1.txt', 'r') as fin,\n",
" open('file2.txt', 'w') as fout):\n",
" fout.write(fin.read())"
]
}
]
}
@jamescalam
Copy link
Author

fout) may be causing an error
Isn't it just fout: ?

fout: would miss the closing bracket of with (

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment