`If ` Q from newbie

Ian Pellew ipellew at pipemedia.co.uk
Fri Feb 20 13:51:54 CET 2004


Hi all;

As my starter into Python I have a small project using pullparser.py

My problem is testing what is coming back from a def() in
pullparser.py
I bet this is me not understanding something in Python.

I do

..
tk = p.get_token()
print tk




and get:-
1  Token('data', '\n \n\n', None)
2  Token('comment', '#include virtual="/software/main/inc/warning.inc"
', None)
3  Token('data', '\n\n', None)
4  Token('startendtag', 'meta', [('name', 'DC.Rights'), ('content',
'Copyright (c) 2004 by IBM Corporation')])
5  Token('data', '\n', None)
6  Token('startendtag', 'meta', [('name', 'Security'), ('content',
'Public')])
7  Token('data', '\n', None)
8  Token('startendtag', 'meta', [('name', 'Robots'), ('content',
'index,follow')])
9  Token('data', '\n', None)
    Etc.

I wanna 
"if (tk????? is None): continue"

More generally, how do I know what is being returned from a def()? 

Pointers/Advice pls.

Regards
Ian



More information about the Python-list mailing list