Take notes on the command line: Difference between revisions

Content added Content deleted
Line 1,628: Line 1,628:
if len(sys.argv) == 1:
if len(sys.argv) == 1:
try:
try:
f = open('notes.txt', 'r')
with open('notes.txt', 'r') as f:
shutil.copyfileobj(f, sys.stdout)
shutil.copyfileobj(f, sys.stdout)
f.close()
except IOError:
except IOError:
pass
pass
else:
else:
f = open('notes.txt', 'a')
with open('notes.txt', 'a') as f:
f.write(datetime.datetime.now().isoformat() + '\n')
f.write(datetime.datetime.now().isoformat() + '\n')
f.write("\t%s\n" % ' '.join(sys.argv[1:]))
f.write("\t%s\n" % ' '.join(sys.argv[1:]))</lang>
f.close()</lang>


'''Sample notes.txt file'''
'''Sample notes.txt file'''