Re: [Tutor] search-replace

2011-06-06 Thread davidheiserca
.write(open("dirtyfile.txt", 'r').read().replace('## ', '#')) - Original Message - From: "Tommy Kaas" To: Sent: Monday, June 06, 2011 2:58 AM Subject: Re: [Tutor] search-replace -Oprindelig meddelelse- Fra: tutor-bounces+t

Re: [Tutor] search-replace

2011-06-06 Thread Tommy Kaas
> -Oprindelig meddelelse- > Fra: tutor-bounces+tommy.kaas=kaasogmulvad...@python.org > [mailto:tutor-bounces+tommy.kaas=kaasogmulvad...@python.org] På vegne > af Alan Gauld > Sendt: 6. juni 2011 11:51 > Til: tutor@python.org > Emne: Re: [Tutor] search-replace >

Re: [Tutor] search-replace

2011-06-06 Thread Alan Gauld
"Tommy Kaas" wrote I'm especially interested to know how I do more than just one search-replace without having to repeat the whole step below. fin = open("dirtyfile.txt") fout = open("cleanfile.txt", "w") for line in fin: fout.write(line.replace('## ', '#')) fin.close() fout.close() Can