I am looking to make this code a little "nicer"... any suggestions???
I want to do a "read+" where I would be able to first read the contents of
the file... then either close the file out or write to the file without
appending. I want to overwrite the content.
vacation_messag e = "blah blah blah"
f_vm=open("/home/%s/.vacation.msg" %userid, 'r')
lines=f_vm.read lines()
f_vm.close()
if (lines != vacation_messag e):
f_vm=open("/home/%s/.vacation.msg" %userid, 'w')
f_vm.writelines (vacation_messa ge)
f_vm.close()
Thanks
I want to do a "read+" where I would be able to first read the contents of
the file... then either close the file out or write to the file without
appending. I want to overwrite the content.
vacation_messag e = "blah blah blah"
f_vm=open("/home/%s/.vacation.msg" %userid, 'r')
lines=f_vm.read lines()
f_vm.close()
if (lines != vacation_messag e):
f_vm=open("/home/%s/.vacation.msg" %userid, 'w')
f_vm.writelines (vacation_messa ge)
f_vm.close()
Thanks
Comment