本文整理汇总了Python中location.Location.setTypes方法的典型用法代码示例。如果您正苦于以下问题:Python Location.setTypes方法的具体用法?Python Location.setTypes怎么用?Python Location.setTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类location.Location
的用法示例。
在下文中一共展示了Location.setTypes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_one_location_page
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import setTypes [as 别名]
def parse_one_location_page(page, country, city, event_type):
location_name = parse_location_element(page.xpath(locationNameOnPage)[0])
location = Location(location_name, country, city, event_type)
description = ""
raw_description = page.xpath(locationDescriptionOnPage)
for p in raw_description:
description = description + p.replace("\n","")
location.setDescription(description)
latitude_raw = page.xpath(latitudeOnPage)
longitude_raw = page.xpath(longitudeOnPage)
if(len(latitude_raw) > 0):
location.setLatitude(float(latitude_raw[0]))
if(len(longitude_raw) > 0):
location.setLongitude(float(longitude_raw[0]))
additional_details = find_details_from_location(location, event_type)
location.setDuration(additional_details[1])
location.setRatings(additional_details[2])
location.setNetRating(additional_details[4])
location.setHours(additional_details[3])
location.setTypes(additional_details[5])
location.setCertificate(additional_details[6])
return location