[Tutor] Reading from files problem

Chris Castillo ctcast at gmail.com
Mon Apr 20 04:34:49 CEST 2009


so how would I check to see if the student number entered by the user
matches one of the student numbers in the file and then display that
students info?

On 4/19/09, R. Alan Monroe <amonroe at columbus.rr.com> wrote:
>
>> gradesfile = open("grades.dat", "r
>> for lines in gradesfile:
>> [snip]
>> That's what I have so far but I have a feeling I shouldn't use a for
>> loop.
>
> Actually a for loop seems like the right tool for this job, assuming
> you really _do_ want to process every line in the file.
>
> Alan
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list