![]() |
|
Python Log - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Python (https://sinister.li/Forum-Python) +--- Thread: Python Log (/Thread-Python-Log) |
Python Log - ImMe - 02-09-2014 I was trying to write a simple log for a software I'm working on and I came across an error. I couldn't find out what was wrong so I thought someone else might be able to... Code: import getpass
pc_user = getpass.getuser()
target_log = 'C:\Users\' + pc_user + '\Desktop\log.txt'
with open(target_log, 'a') as the_file:
the_file.write('Hello\n') |