本文整理匯總了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