本文整理匯總了Python中emojipy.Emoji.to_image方法的典型用法代碼示例。如果您正苦於以下問題:Python Emoji.to_image方法的具體用法?Python Emoji.to_image怎麽用?Python Emoji.to_image使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類emojipy.Emoji
的用法示例。
在下文中一共展示了Emoji.to_image方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: replace_with_emoji
# 需要導入模塊: from emojipy import Emoji [as 別名]
# 或者: from emojipy.Emoji import to_image [as 別名]
def replace_with_emoji(effect, size):
"""
Reportlab's Paragraph doesn't accept normal html <image> tag's attributes
like 'class', 'alt'. Its a little hack to remove those attrbs
"""
e = ""
for i, c in enumerate(effect):
if c in emoji.UNICODE_EMOJI:
e += Emoji.to_image(c)
else:
e += c
# e = effect
# for item in sorted(emoji.UNICODE_EMOJI.keys(), key = len, reverse = True):
# if item in effect:
# print(item)
# if Emoji.to_image(item) != item:
# e = re.sub(item, Emoji.to_image(item), e)
# print(item)
# Emoji.to_image(c)
# e = re.sub(re.escape(item), re.escape(emoji.UNICODE_EMOJI[item]), e)
e = e.replace('class="emojione " style="" ', 'height=%s width=%s' %
(size, size))
return re.sub('alt="'+Emoji.shortcode_regexp+'"', '', e)
示例2: to_image
# 需要導入模塊: from emojipy import Emoji [as 別名]
# 或者: from emojipy.Emoji import to_image [as 別名]
def to_image(text, **kwargs):
"""
Parse short code and unicode code to emotion
:param text:
:param kwargs[css]: css class
:param kwargs[style]: icon stylesheet
:return: string
"""
return Emoji.to_image(text, **kwargs)
示例3: to_image
# 需要導入模塊: from emojipy import Emoji [as 別名]
# 或者: from emojipy.Emoji import to_image [as 別名]
def to_image(text, **kwargs):
return Emoji.to_image(text, **kwargs)