At least I know the basics of file I/O for here is my filereader and filewriter programs: Filereader: filename = raw_input("File name please: ") f = file(filename, "r") for line in f.readlines(): print line f.close()
Filewriter: text = raw_input("Enter some text to export: ") filename = raw_input("File to write to: ") out_file = open(filename,"w") out_file.write(text) out_file.close() ----- Original Message ----- From: "Nathan Pinno" <[EMAIL PROTECTED]> To: "Danny Yoo" <[EMAIL PROTECTED]> Cc: "Tutor mailing list" <tutor@python.org> Sent: Wednesday, August 03, 2005 9:03 PM Subject: Re: [Tutor] What's the invalid syntax? Code supplied >I added a plus sign to show Python to add "\n" or a new line to end of the > file. > ----- Original Message ----- > From: "Danny Yoo" <[EMAIL PROTECTED]> > To: "Nathan Pinno" <[EMAIL PROTECTED]> > Cc: "Tutor mailing list" <tutor@python.org> > Sent: Wednesday, August 03, 2005 8:53 PM > Subject: Re: [Tutor] What's the invalid syntax? Code supplied > > >> >> >> On Wed, 3 Aug 2005, Nathan Pinno wrote: >> >>> I forgot to add that it works because commas separate it into groups so >>> that >>> when the reads the file it has output, the program can split it into the >>> site, ID, and passcard. >> >> >> Hi Nathan, >> >> Ok, it's good that we're looking back, because that's not right; commas >> did not have to do with what was causing problems. Let's look at the >> buggy statement again. >> >> out_file.write(site+","+sitelist[site][0]+","+sitelist[site][1]"\n") >> >> With fresh eyse, can you look back at how you corrected this? >> >> >> If you think this my insisting on you seeing why things weren't working, >> consider this: if it's an easy error to make (and it is an easy mistake >> to >> make), you may want to spend some time to learn how to recognize the >> error >> and its correction. That way, you don't have to wait for folks on Tutor >> to point things out for you. >> >> > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor