Re: command-line one-liners a la Perl?

2009-06-18 Thread unayok
On Jun 18, 9:36 am, kj wrote: > I'm a recovering Perl addict, and I'm jonesin' badly for command-line > one-liners, like > >   % perl -lne '@f=split "\t";print join "\t",@f[3,1] if $f[2]=~/frobozz/i' > in.txt > > How can I get my fix with Python? > > kynn I'd encourage you to learn the ways of P

Re: Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread unayok
On Jun 24, 12:11 pm, humn wrote: > but this doesn't: > > if '\title' in line: >         line = line.replace('\title{', '[size=150][b]') >         line = line.replace('}', '[/b][/size]') \t is an escaped character. so, '\title' will look for 'itle' Two ways to fix this: 1. use r'\title' 2. use

Re: Reading then sending new parts of a log file

2009-06-24 Thread unayok
On Jun 24, 10:23 am, Chuck Connors wrote: > Hey guys.  I'm trying to work up a little program that will send any > new lines written to a file (log file from my home automation > software) to me via instant message.  I've gotten the instant message > sending part figured out using xmpppy. > > I've

Re: ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread unayok
On Jun 25, 9:02 pm, Kee Nethery wrote: > Summary: I have XML as string and I want to pull it into ElementTree > so that I can play with it but it is not working for me. XML and > fromstring when used with a string do not do the same thing as parse > does with a file. How do I get this to work? > >