looping and deleting

Aahz aahz at pythoncraft.com
Mon Apr 21 18:20:44 CEST 2003


In article <3cf72d52.0304210801.2128eca2 at posting.google.com>,
scn <regnivon at netscape.net> wrote:
>
>what is a good method for looping over a file line-by-line and
>deleting the first 3 characters?

Are you trying to modify the file in-place?  If so, look at the
fileinput module.  If not:

input = <somefile>
output = <some other file>
for line in input:
    output.write(line[3:])
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Why is this newsgroup different from all other newsgroups?




More information about the Python-list mailing list