当前位置: 首页>>代码示例>>Python>>正文


Python NSString.stringWithContentsOfURL_方法代码示例

本文整理汇总了Python中Foundation.NSString.stringWithContentsOfURL_方法的典型用法代码示例。如果您正苦于以下问题:Python NSString.stringWithContentsOfURL_方法的具体用法?Python NSString.stringWithContentsOfURL_怎么用?Python NSString.stringWithContentsOfURL_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Foundation.NSString的用法示例。


在下文中一共展示了NSString.stringWithContentsOfURL_方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _fetchLists

# 需要导入模块: from Foundation import NSString [as 别名]
# 或者: from Foundation.NSString import stringWithContentsOfURL_ [as 别名]
	def _fetchLists(self):
		"""A private convenience function that uses BeautifulSoup (for parsing) and NSString (for authentication) 
		to make combing the HTML code from the main page of lists a bit easier."""
		page = NSString.stringWithContentsOfURL_(NSURL.URLWithString_("http://%s.tadalist.com/lists" % (self.username)))
		soup = BeautifulSoup(page)
		rawLists = soup.findAll('li')
		lists = []
		for rawList in rawLists:
			lists.append( TadaList(rawList.a['href'], rawList.a.contents[0], self) )
		return lists	
开发者ID:Grayson,项目名称:PyTadaList,代码行数:12,代码来源:tadalist.py

示例2: _fetchItems

# 需要导入模块: from Foundation import NSString [as 别名]
# 或者: from Foundation.NSString import stringWithContentsOfURL_ [as 别名]
	def _fetchItems(self, force=True):
		"""Private method that fetches attributes off of the list's page, parses the HTML (with BeautifulSoup),
		and then creates TadaItems.  This is called automatically when a user requests the 'items' of a TadaList."""
		page = NSString.stringWithContentsOfURL_(NSURL.URLWithString_(self._url()))
		soup = BeautifulSoup(page)
		lis = soup.findAll('li')
		items = []
		for li in lis: 
			items.append(TadaItem(li.form.contents[-1].strip(), li['id'][5:], self))
		self.items = items
		return self.items
开发者ID:Grayson,项目名称:PyTadaList,代码行数:13,代码来源:tadalist.py


注:本文中的Foundation.NSString.stringWithContentsOfURL_方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。