A
Amy G
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_message = "blah blah blah"
f_vm=open("/home/%s/.vacation.msg" %userid, 'r')
lines=f_vm.readlines()
f_vm.close()
if (lines != vacation_message):
f_vm=open("/home/%s/.vacation.msg" %userid, 'w')
f_vm.writelines(vacation_message)
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_message = "blah blah blah"
f_vm=open("/home/%s/.vacation.msg" %userid, 'r')
lines=f_vm.readlines()
f_vm.close()
if (lines != vacation_message):
f_vm=open("/home/%s/.vacation.msg" %userid, 'w')
f_vm.writelines(vacation_message)
f_vm.close()
Thanks