`If ` Q from newbie
wes weston
wweston at att.net
Fri Feb 20 10:35:43 EST 2004
Ian,
It looks like the function call is returning a Token
object and that the Token object has three fields? You need
to go into the pullparser.py file and find out what "p" is -
not shown in your example. When the type of p is known,
find out out what p.get_token() is doing.
Ian Pellew wrote:
> 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