You don't need to serialize and then apply TAG a second time. Just do:

    h = TAG(h)
    op_id = h.element('div.operations a.cheque')
    print op_id, op_id['_href'], op_id[0]

Anthony

On Friday, June 5, 2015 at 7:40:50 AM UTC-4, Dmitry Ermolaev wrote:
>
> To parsing A tag:
>     h = '''
>             <div class="operations">
>                 <a class="cheque" 
> href="/report/cheque.action?transaction=5315416947&amp;direction=OUT" 
> target="_blank">
>                     Show this
>                 </a>
>             </div>
>             '''
>     h = TAG(h)
>     op_id = h.element('div.operations a.cheque')
>     op_id = '%s' % op_id
>     op_id = TAG(op_id)
>     op_id1 = op_id[0]['_href']
>     op_id2 = op_id[0][0]
>     print op_id[0], op_id[0]['_href'], op_id[0][0]
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to