Trying to read in data for a file to a python application
zleap at disroot.org
Tue Feb 26 13:12:13 EST 2019
On 26/02/2019 15:51, Paul Sutton wrote:
> I have been trying to write a small application that is essentially user
> information application.
> So far I have managed to write the data generated to a file, what I want
> to do now, is read this data back in when the user opens the program.
> Trying to use
> with open(fname) as f:
> content = f.readlines()
> # you may also want to remove whitespace characters like `\n` at the end
> of each line
> content = [x.strip() for x in content]
> Trying to use this as a guide (hence my code is a little different).
> But am really stuck
> So far the GUI window appears but no widgets. So something is clearly
> getting stalled.
> To begin with If I can read the text in, and just display in the console
> this is a start, I can then see if I can figure out how to take that and
> insert the data in to the right places.
> Can anyone help please.
Thank you for the comments and adding some 'sanity' to my problem
solving. I will do as suggested and create a Python program to read /
write then move on to integrating that in to the main program.
More information about the Python-list