Reuben
2015-10-15 16:00:09 UTC
Hi All,
I need some clarification for below code. In line 2 of below code snippet,
I have provided read and write permission. Assuming I have provided some
string input as requested in line 1 - when I try to open "check.txt" file
after running the script, it is always empty - it does not display the user
input provided.
May I know why?
######################################################################
input1 = raw_input("Input1:")
file = open("check.txt", "r+")
file.write(input1 + "\n")
for line in file:
print line
print file.close()
######################################################################
Regards,
RD.
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
I need some clarification for below code. In line 2 of below code snippet,
I have provided read and write permission. Assuming I have provided some
string input as requested in line 1 - when I try to open "check.txt" file
after running the script, it is always empty - it does not display the user
input provided.
May I know why?
######################################################################
input1 = raw_input("Input1:")
file = open("check.txt", "r+")
file.write(input1 + "\n")
for line in file:
print line
print file.close()
######################################################################
Regards,
RD.
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor