Dec-30-2017, 10:52 AM
(Dec-30-2017, 10:44 AM)squenson Wrote: When you executereadgrades = gradesfile.readline()
, the value of readgrades is fixed until you change it. Therefore, it is normal that on lines 5 and 8, the result is the same. You need to execute anotherreadline()
statement to change the value.
The best way to do it is to make a loop like:
for readgrades in gradesfile: print(readgrades)If you want to assign a method to a variable, you do it this way (note the presence or absence of parenthesis):
readgrades = gradesfile.readline # without parenthesis, you assign a method print(readgrades()) # running the method (returning its value) requires parenthesis print(readgrades())
makes sense, thanks for the assistance, much appreciated.