[Tutor] Variable and a raw string
Alessandro Caudilho
caudilho at cock.li
Mon Jan 20 14:50:24 EST 2020
Hello all
my code below:
============================
from datetime import datetime
state = 'colorado/us'
with open('/home/user/' + state + '.txt', 'a') as f:
time = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
f.write(time)
f.close()
============================
And I get FileNotFoundError: [Errno 2] No such file or directory: "/home/user/colorado/us'.txt"
So how can I create a variable and assign the raw string to it? Are there other solutions for this problem?
--
Alessandro Caudilho <caudilho at cock.li>
More information about the Tutor
mailing list