re.Scanner - match python dot notation

Peter Otten __peter__ at web.de
Mon Feb 7 12:28:57 EST 2011


Christian K. wrote:

> I am trying to find a regexp to be used with re.Scanner that matches the
> 'package.module.member' syntax. More specifically I want to parse
> function strings like
> 
> numpy.sin(x*a+w)
> 
> and sort out variables/constants.

No direct answer, but regarding your ultimate goal the ast module might be a 
better starting point.



More information about the Python-list mailing list