Here is my code atm
room_num = raw_input("Enter your room number: ")
text_file = open("c:/roombookings.txt", "r")
whole_thing = text_file.readline()
if room_num in whole_thing:
print "Room number found here is the information:"
else :
print "Room number not found."
single_line = whole_thing.split('\n')
for single_line in text_file.readlines():
if room_num in single_line:
print single_line
fileObj = open("courseinfo.dat","w")
fileObj.write(???????????????????????????)
fileObj.close()
text_file.close()
The user types in a roomnumber and the script displays the information regarding the roomnumber only. What i need to do is have the script save the same data to a seperate file. I can get the script to create the file but not the results from the search.
I am 85% sure that where i have the ????????? is where the answer lies... however i am not smart enough to know exactly what i am doing wrong
What should i be doing that i have forgotten?