本文整理汇总了Python中photo.Photo.url_m方法的典型用法代码示例。如果您正苦于以下问题:Python Photo.url_m方法的具体用法?Python Photo.url_m怎么用?Python Photo.url_m使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类photo.Photo
的用法示例。
在下文中一共展示了Photo.url_m方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_photo_from_file
# 需要导入模块: from photo import Photo [as 别名]
# 或者: from photo.Photo import url_m [as 别名]
def get_photo_from_file(self,filepath):
fin = open(filepath,'r')
photos = []
photo = Photo()
for line in fin:
items = line.split(':', 1)
key = items[0].strip()
if(len(items)>1):
value = items[1].strip()
if(key=='ID'):
photo = Photo()
photo.photoId = value
if(key=='owner'):
photo.ownerId = value
if(key=='tags'):
value = value.split(',')
photo.tags = []
for v in value:
v = v.strip()
keep = 0
for c in v:
if(c>='a' and c<='z' or c>='A' and c<='Z'):
keep = 1
else:
keep = 0
break
if (keep):
photo.tags.append(v)
if(key=='url'):
photo.url = value;
if(key=='datetaken'):
value = value.split(' ')
photo.datetaken = value[0].strip();
if (len(value) > 1):
photo.timetaken = value[1].strip();
if(key=='secret'):
photo.secret = value
if(key=='farm'):
photo.farm = value
if(key=='url_s'):
photo.url_s = value
if(key=='url_q'):
photo.url_q = value
if(key=='url_t'):
photo.url_t = value
if(key=='url_m'):
photo.url_m = value
if(key=='url_z'):
photo.url_z = value
if(key=='url_b'):
photo.url_b = value
if(len(key)==0):
if(self.is_valid_photo(photo)):
photos.append(photo)
return photos
示例2: getPhotoFromFile
# 需要导入模块: from photo import Photo [as 别名]
# 或者: from photo.Photo import url_m [as 别名]
def getPhotoFromFile(self,filepath):
fin = open(filepath,'r')
photo = Photo()
for line in fin:
items = line.split(':', 1)
key = items[0].strip()
if(len(items)>1):
value = items[1].strip()
if(key=='ID'):
photo = Photo()
photo.photoId = value
if(key=='owner'):
photo.ownerId = value
if(key=='tags'):
value = value.split(',')
photo.tags = []
for v in value:
v = v.strip()
if(len(v)>30):
continue;
if(v>='a' and v<='z' or v>='A' and v<='Z'):
photo.tags.append(v)
if(key=='url'):
photo.url = value;
if(key=='datetaken'):
value = value.split(' ');
photo.datetaken = value[0].strip();
if (len(value) > 1):
photo.timetaken = value[1].strip();
if(key=='secret'):
photo.secret = value
if(key=='farm'):
photo.farm = value
if(key=='url_s'):
photo.url_s = value
if(key=='url_q'):
photo.url_q = value
if(key=='url_t'):
photo.url_t = value
if(key=='url_m'):
photo.url_m = value
if(key=='url_z'):
photo.url_z = value
if(key=='url_b'):
photo.url_b = value
return photo