Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28482
| From | Gilles <nospam@nospam.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: [2.5.1] Read each line from txt file, replace, and save? |
| Date | 2012-09-05 14:52 +0200 |
| Message-ID | <anie489odk5jaqi5faurj615f8lirk97qv@4ax.com> (permalink) |
| References | <uec64893qomnns4ih36319m47bkkpqr488@4ax.com> <nid648l7k80oli3t84okl598s5fqkgascn@4ax.com> <mailman.97.1346609082.27098.python-list@python.org> |
| Organization | Guest of ProXad - France |
On Sun, 02 Sep 2012 14:04:29 -0400, Terry Reedy <tjreedy@udel.edu> wrote: >If you process each line separately, there is no reason to read them all >at once. Use the file as an iterator directly. Since line is already a >string, there is no reason to copy it into a new string. Combining these >two changes with Mark's suggestion to use with and we have the following >simple code: Thanks guys for the suggestion.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
[2.5.1] Read each line from txt file, replace, and save? Gilles <nospam@nospam.com> - 2012-09-02 12:19 +0200
Re: [2.5.1] Read each line from txt file, replace, and save? Gilles <nospam@nospam.com> - 2012-09-02 12:36 +0200
Re: [2.5.1] Read each line from txt file, replace, and save? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-02 12:02 +0100
Re: [2.5.1] Read each line from txt file, replace, and save? Terry Reedy <tjreedy@udel.edu> - 2012-09-02 14:04 -0400
Re: [2.5.1] Read each line from txt file, replace, and save? Gilles <nospam@nospam.com> - 2012-09-05 14:52 +0200
csiph-web