Python: Having trouble reading in files -


i having trouble reading in files through python 2.7. prompt user load file, , once filename given, program load , print lines in file.

filename = raw_input("filename load: ") print load_records(students, filename)  def load_records(students, filename):     #loads student records file     records = []     in_file = open(filename, "r")     line in in_file:         print line 

however, if entire file path specified, program throws 'valueerror: mixing iterations , read methods lose data.'


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -