1、Because emoji aren’t quite as easy to type as text, at least on laptops and desktops, some programs support “codes,” whereby you can type, for instance, :thumbs_up:
, which will be automatically converted to 👍. Some programs additionally support aliases, whereby you can more succinctly type, for instance, :thumbsup:
, which will also be automatically converted to 👍
See carpedm20.github.io/emoji/all.html?enableList=enable_list_alias for a list of codes with aliases.
In a file called emojize.py
, implement a program that prompts the user for a str
in English and then outputs the “emojized” version of that str
, converting any codes (or aliases) therein to their corresponding emoji.
import emoji
def main():
words = input("Input: ")
print(emoj(words))
def emoj(em):
return emoji.emojize(em)
if __name__ == "__main__":
main()
2、Among the fonts supported by FIGlet are those at figlet.org/examples.html.
FIGlet has since been ported to Python as a module called pyfiglet.
In a file called figlet.py
, implement a program that:
- Expects zero or two command-line arguments:
- Zero if the user would like to output text in a random font.
- Two if the user would