本文整理汇总了Python中photo.Photo.getUserName方法的典型用法代码示例。如果您正苦于以下问题:Python Photo.getUserName方法的具体用法?Python Photo.getUserName怎么用?Python Photo.getUserName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类photo.Photo
的用法示例。
在下文中一共展示了Photo.getUserName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: removeDuplicatePhotos
# 需要导入模块: from photo import Photo [as 别名]
# 或者: from photo.Photo import getUserName [as 别名]
def removeDuplicatePhotos(self):
# this method is not good, just for tempory use
# by judging if the caption is duplicate
new_photos = []
num_duplicate = 0
for photo in self._event['photos']:
p = Photo(photo)
is_duplicate = False
cap1 = p.getCaption()
user1 = p.getUserName()
for new_photo in new_photos:
p2 = Photo(new_photo)
cap2 = p2.getCaption()
user2 = p2.getUserName()
if user1 == user2 and (len(cap1)>0 and cap1 == cap2):
is_duplicate = True
num_duplicate += 1
break
if not is_duplicate:
new_photos.append(photo)
if num_duplicate > 0:
self._event['photos'] = new_photos
return num_duplicate