Thanks a lot, Danny.
Yeah, my goal is to do XML parsing and for that I will be using ElementTree.
As you pointed out, regular expressions are very powerful, so I better get some idea of about them.
 
Cheers.
Asrarahmed

 
On 10/30/06, Danny Yoo <[EMAIL PROTECTED]> wrote:

> Is it useful to know re module and its functions..??

HI Asrarahmed,

Yes.  Most people find them to be invaluable in their day-to-day work.
The problem is that they're powerful enough that they look like an
all-in-one tool: it's tempting to use them, even when they are the wrong
tool for the job. *grin* So at least know about regular expressions,
enough to know when and when not to use them.

You might want to look at the Regex HOWTO:

     http://www.amk.ca/python/howto/regex/

to get more familiar with regular expressions.



> Or the string module has enough utilities to accomplish string
> manipulation..!!!

For simple things, I'd stick with the methods in strings.  For other
complicated tasks, regular expressions may be the right tool.  But for
anything that deals with structure (i.e. HTML, XML, JSON), using a real
parser for that language is more appropriate.  (Those parsers will usually
be built on top of regular expressions, to hide some ugliness from you.)

Concretely, if anyone asks you to if they can use regular expressions to
parse XML, try to convince them to look into the ElementTree library
first.


Good luck!



--
To HIM you shall return.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to