3 ms·
Yeah, not the best example I think. This code is not bad at all: filepath = os.path.join('.', 'test_dirs) os.makedirs(filepath) with open(os.path.j
by viraptor 13y ago
Yeah, not the best example I think. This code is not bad at all:
filepath = os.path.join('.', 'test_dirs)
os.makedirs(filepath)
with open(os.path.join(filepath, 'test.txt'), 'w') as f:
f.write('hello world')
And it's actually obvious what happens with the file handle after write. I'm not sure if it's still open or not at the end of his example really. I wouldn't be surprised by his example in ruby code (overloading with magic functionality), but in python that just looks weird...