GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing pythonhosted.org — Testing for Existence — feedparser 5.2.0 documentation Testing for Existence¶Feeds in the real world may be missing elements, even elements that are required by the specification. You should always test for the existence of an element before getting its value. Never assume an element is present. To test whether elements exist, you can use standard Python dictionary idioms. Testing if elements are present¶>>> import feedparser >>> d = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml') >>> 'title' in d.feed True >>> 'ttl' in d.feed False >>> d.feed.get('title', 'No title') u'Sample feed' >>> d.feed.get('ttl', 60) 60 |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |