The Artima Developer Community
Sponsored Link

Python Answers Forum
How to convert details from a saved text file into a list of files

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Juri Huuhtanen

Posts: 1
Nickname: thepain
Registered: Dec, 2011

How to convert details from a saved text file into a list of files Posted: Dec 2, 2011 11:31 AM
Reply to this message Reply
Advertisement
Hello! Can somebody help with my programming course work?
Basically I am creating a class for few details of a house which i then append it in to a list and finally add into a text file. When I open the file it prints like this e.g. Jackson, 12, 4, 4
If I have many lines of data in a text file, how can i convert these values back into the details of class as they were before the addition into a list.
e.g
Jackson, 12, 4, 4
Brown, 23, 34, 4

I want to print all this like we do in class files so that I can use this data for later calcultation. Variables are inserted in a loop so the number of inputs can be any.

Thank you in advance! Here is m



def loadFile():
try:
h = input("Give the filename to open: ")
t1 = open(h, "r")
talo2 = Talo()
while True:
line = t1.read()
if len(line)> 0:
print(rivi)

if len(rivi)== 0:
print("Files are loaded")
list.append(talo2)
break
except nameError:
print("File does not exist")
return lista

Topic: Access progress bar within a jframe Previous Topic   Next Topic Topic: top down design in python

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use