Re: [Tutor] Writing to text files

2014-03-28 Thread Ben Finney
"Nathan Curnow (Year 10)" <13...@budehaven.cornwall.sch.uk> writes: > HU. HU. HU. Here's hoping you improve your communication skills during Year 10, Nathan. -- \ “What we usually pray to God is not that His will be done, but | `\ that He approve ours.” —Helga Berg

[Tutor] Writing to text files

2014-03-28 Thread Nathan Curnow (Year 10)
HU. HU. HU. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Writing to text files

2005-08-22 Thread Byron
Byron wrote: > Hi Danny, > > I agree 100% with your statement. The reason why I left it in its > "fragile" state was to help keep the example provided simple and > straight forward. Since this is a "beginners" group, I wanted to > confuse by adding extra protection to it. ;-) > > Byron > ---

Re: [Tutor] Writing to text files

2005-08-22 Thread Byron
Danny Yoo wrote: > > >>It's actually fairly simply and straight forward... Here's how to do >>it: (I haven't officially tested this code for bugs, but I believe it >>is correct.) >> >>file = open("datafile.txt", "r") >>filedata = file.read() >>file.close() >> >>newLine = "Your new line of data

Re: [Tutor] Writing to text files

2005-08-22 Thread Danny Yoo
> It's actually fairly simply and straight forward... Here's how to do > it: (I haven't officially tested this code for bugs, but I believe it > is correct.) > > file = open("datafile.txt", "r") > filedata = file.read() > file.close() > > newLine = "Your new line of data with the time stamp goe

Re: [Tutor] Writing to text files

2005-08-22 Thread Orri Ganel
Bob Gailer wrote: >At 08:09 AM 8/22/2005, Byron wrote: > > >>Hi Johan, >> >>It's actually fairly simply and straight forward... Here's how to do >>it: (I haven't officially tested this code for bugs, but I believe it >>is correct.) >> >>file = open("datafile.txt", "r") >> >> > >This is an

Re: [Tutor] Writing to text files

2005-08-22 Thread Bob Gailer
At 08:09 AM 8/22/2005, Byron wrote: >Hi Johan, > >It's actually fairly simply and straight forward... Here's how to do >it: (I haven't officially tested this code for bugs, but I believe it >is correct.) > >file = open("datafile.txt", "r") This is an example of rebinding to a name originally bou

Re: [Tutor] Writing to text files

2005-08-22 Thread Orri Ganel
Byron wrote: >Hi Johan, > >It's actually fairly simply and straight forward... Here's how to do >it: (I haven't officially tested this code for bugs, but I believe it >is correct.) > >file = open("datafile.txt", "r") >filedata = file.read() >file.close() > >newLine = "Your new line of data wit

Re: [Tutor] Writing to text files

2005-08-22 Thread Byron
Hi Johan, It's actually fairly simply and straight forward... Here's how to do it: (I haven't officially tested this code for bugs, but I believe it is correct.) file = open("datafile.txt", "r") filedata = file.read() file.close() newLine = "Your new line of data with the time stamp goes her

Re: [Tutor] Writing to text files

2005-08-22 Thread Alan G
> I want to write to a text file with a timestamp, but I want to > newest > entry at the top. So I want to insert the next entry to the file at > the > beginning. You will need to create a new file. Basically you need to: Read the current file into a list or string. Rename the old file (foo.ba

Re: [Tutor] Writing to text files

2005-08-22 Thread Andreas Kostyrka
Am Montag, den 22.08.2005, 09:30 +0200 schrieb Johan Geldenhuys: > Hi all, > I want to write to a text file with a timestamp, but I want to newest > entry at the top. So I want to insert the next entry to the file at > the beginning. > I can create and append to a file and then the latest entry is

[Tutor] Writing to text files

2005-08-22 Thread Johan Geldenhuys
Hi all, I want to write to a text file with a timestamp, but I want to newest entry at the top. So I want to insert the next entry to the file at the beginning. I can create and append to a file and then the latest entry is at the bottom. Any ideas how this is done please? Thanks, Johan __