Paul:  That works better!  Thanks.  The parser is xml.sax.

Jeff

Jeff Johnson
[EMAIL PROTECTED]
SanDC, Inc.
623-582-0323
Fax 623-869-0675

Paul McNett wrote:
> Jeff Johnson wrote:
> 
>> In order to load an xml document into a parser I need to strip '\n' and 
>> '\r',  This is how I am doing it and it works:
>>
>> f = open(sys.argv[1], 'r')
>> s = f.read()
>> f.close()
>> # remove returns
>> s = s.replace('\n', '')
>> s = s.replace('\r', '')
>> o = open('testo.imf', 'w')
>> o.write(s)
>> o.close()
>>
>> Is there a better way?  IOW perform the stripping directly on the input 
>> file?
> 
> Which XML parser can't handle newlines?
> 
> Try:
> 
> """
> out = open('testo.imf', 'wb')
> 
> for line in open(sys.argv[1]):
>    out.write(line.replace('\n', '').replace('\r', ''))
> 
> out.close()
> """
> 
> Paul
> 


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to