Created
August 24, 2018 18:42
-
-
Save craigboman/c96b5c652613d87f606a057a826030c9 to your computer and use it in GitHub Desktop.
describes a file read/write error in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pth= '../json/' | |
#failed attempt to split out base filename: base = os.path.splitext(filename)[0] | |
merge = os.path.join(pth, Path(filename).stem) | |
with open(merge, 'w') as f: | |
json.dump(words, f, ensure_ascii=False) | |
f.close() | |
jsn = merge+'.json' | |
os.rename(merge, jsn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment