Changeset 1076 for trunk/genshi/input.py
- Timestamp:
- Nov 10, 2009, 10:22:51 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/genshi/input.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/genshi/input.py
r1075 r1076 80 80 >>> parser = XMLParser(StringIO('<root id="2"><child>Foo</child></root>')) 81 81 >>> for kind, data, pos in parser: 82 ... print kind, data82 ... print('%s %s' % (kind, data)) 83 83 START (QName(u'root'), Attrs([(QName(u'id'), u'2')])) 84 84 START (QName(u'child'), Attrs()) … … 257 257 258 258 >>> xml = XML('<doc><elem>Foo</elem><elem>Bar</elem></doc>') 259 >>> print xml259 >>> print(xml) 260 260 <doc><elem>Foo</elem><elem>Bar</elem></doc> 261 >>> print xml.select('elem')261 >>> print(xml.select('elem')) 262 262 <elem>Foo</elem><elem>Bar</elem> 263 >>> print xml.select('elem/text()')263 >>> print(xml.select('elem/text()')) 264 264 FooBar 265 265 … … 281 281 >>> parser = HTMLParser(StringIO('<UL compact><LI>Foo</UL>')) 282 282 >>> for kind, data, pos in parser: 283 ... print kind, data283 ... print('%s %s' % (kind, data)) 284 284 START (QName(u'ul'), Attrs([(QName(u'compact'), u'compact')])) 285 285 START (QName(u'li'), Attrs()) … … 410 410 411 411 >>> html = HTML('<body><h1>Foo</h1></body>') 412 >>> print html412 >>> print(html) 413 413 <body><h1>Foo</h1></body> 414 >>> print html.select('h1')414 >>> print(html.select('h1')) 415 415 <h1>Foo</h1> 416 >>> print html.select('h1/text()')416 >>> print(html.select('h1/text()')) 417 417 Foo 418 418
Note: See TracChangeset
for help on using the changeset viewer.
