本文整理汇总了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)