newbe question about removing items from one file to another file
Gabriel Genellina
gagsl-py at yahoo.com.ar
Mon Aug 28 20:56:55 EDT 2006
At Sunday 27/8/2006 18:35, Eric_Dexter at msn.com wrote:
(This code don't even compile...!)
>def simplecsdtoorc(filename):
> file = open(filename,"r")
file is not a good name - hides the builtin type of the same name.
Same for dict, list...
> alllines = file.read_until("</CsInstruments>")
read_until???
> pattern1 = re.compile("</")
> orcfilename = filename[-3:] + "orc"
perhaps you want filename[:-3]+"orc"?
> for line in alllines:
> if not pattern1
if not pattern1.search(line):
> print >>orcfilename, line
Open the output file before the loop, and use its write() method here
>I am pretty sure my code isn't close to what I want. I need to be able
>to skip html like commands from <defined> to <undefined> and to key on
>another word in adition to </CsInstruments> to end the routine
Good job for Beautiful Soup: http://www.crummy.com/software/BeautifulSoup/
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
More information about the Python-list
mailing list