Lie Ryan <[EMAIL PROTECTED]> wrote:

> That's the job of regular expression: 'import re'
> 
> numbered_atom = re.compile('[A-Z][a-z]?[0-9]+')
> if numbered_atom.match('C10'):
>     # this is a numbered atom
> if numbered_atom.match('C'):
>     # this WON'T match
> 
> read more about regular expression on the web (hint: python share the 
> same re syntax with many other languages, php, javascript, grep, etc)
> 

Or simply:

if atom[-1].isdigit():
   # this is a numbered atom
else:
   # this isn't
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to