i have things in a text file an index of movies that one owns and can add more but when i want to add a new one but when i have it print the line of a text file it just does this.
i
k
o
g
n
how can i do that and have it display all the contents of my text file instead of just one line
here is my code right now
import easygui
import sys
import os
from easygui import *
msgbox(msg='This program is to keep track of all the movies you own',title='Movie Catalog',ok_button='OK',image=None,root=None)
wouldyou = choicebox(msg='Would you like to enter a movie or view the movies you already own?',title='',choices=('Enter a movie', 'View my movies'))
if wouldyou == "Enter a movie":
msg='Please enter the name of the movie'
title='Movie Catalog'
fieldNames=("Name of movie", "Genre", "Movie description")
fieldValues = []
fieldValues = multenterbox(msg, title, fieldNames)
if fieldValues == None:
sys.exit(0);
fp_out = open("movies.txt", "a")
#enter_another = True
#while enter_another:
myString = "**".join(fieldValues)
fp_out.write("%s\n" %(myString))
fp_out.close()
elif wouldyou == "View my movies":
all_movies = open("movies.txt", "r").readlines()
for ctr, rec in enumerate(all_movies):
name,genre,desc = rec.strip().split("**")
#print "%5s %10s %s" % (name, genre, desc)
choicebox(msg='', title=' ', choices=("%s" % (name)))
raw_input("press any key to exit")