[Tutor] (no subject)
Danny Yoo
dyoo at hashcollision.org
Sun Jul 20 22:31:31 CEST 2014
On Sun, Jul 20, 2014 at 8:40 AM, LN A-go-go
<lnartist at yahoo.com.dmarc.invalid> wrote:
> My apologies Python Gurus for repeating this request for read, write, split
> and append from a text file in notepad. I worked on it till late last night
> and will again today. I can't seem to get past trying to write the names to
> one list and the numbers (converted to integers) to the other. My lists
> come up empty.
That's fine, but please also respond to the replies you're getting
too. Rather than start a whole new thread, try to continue the thread
by using your email client's "Reply to All" feature. Also, feel free
to treat this as a conversation: if there's anything about the replies
that use terms you don't understand, ask, and we'll try to clarify.
Looking closely at your revised program, I see that you've added a
file close. Unfortunately, you closed the wrong file. :P
Effectively, you've written:
myfile = open(filename,"r")
mynewfile = open(newfile,"w")
## writing into mynewfile
myfile.close()
but you needed to have done:
myfile = open(filename,"r")
mynewfile = open(newfile,"w")
## writing into mynewfile
mynewfile.close()
It also appears that you are trying to write whole programs at the
interpreter loop. This can be inconvenient for larger programs. You
might want to use a text editor or IDE to write the program as a
single file, and then run Python over that program file.
More information about the Tutor
mailing list