[PYTHON] I made a script to display emoji


Unfortunately, I can't see the emoji on this page, chrome on mac. I confirmed that it can be seen in safari, so please try it if you like.


There are more opportunities to see pictograms such as? And? On twitter. I wondered what other characters there are, and found that they could be easily displayed with a script, so I made one.

Installation method

Assuming you have python 2. *, run the following command.

$ wget https://github.com/takekawa/emoji/raw/master/emoji
$ chmod 0755 emoji

If you can execute the help and display it as shown below, it is successful.

 $ ./emoji -h  

     Usage: emoji [Options] [Message ...]
        -h --help
           Print this message
        -l --list 
           Print all emoji-characters with the name 
        -a --all 
           Print all emoji-characters without the name 

How to use

Simple example

 $ ./emoji sushi 

Grep to display a list of emoji with the name of clock

 $ ./emoji -l | grep clock
 alarm_clock	⏰
 arrows_clockwise	?
 arrows_counterclockwise	?
 clock1	?
 clock10	?
 clock1030	?
 clock11	?
 clock1130	?
 clock12	?
 clock1230	?
 clock130	?
 clock2	?
 clock230	?
 clock3	?
 clock330	?
 clock4	?
 clock430	?
 clock5	?
 clock530	?
 clock6	?
 clock630	?
 clock7	?
 clock730	?
 clock8	?
 clock830	?
 clock9	?
 clock930	?

Since it is a character, you can also search by pictogram.

 $ ./emoji -l | grep ?
 violin	?

In combination with echo-sd

$ ./echo-sd "sudden$(./emoji sushi)terrorism"
_People People People People People People_
> Sudden?Terrorism <
 ̄Y^Y^Y^Y^Y^Y^Y^Y^ ̄

It's fun just to look at the emoji. In that case, this is recommended.

./emoji -l

Code description

Most of the 1000 lines are dictionaries of emoji names and character codes. The body of the code is only about 30 lines. Depending on the argument, a specific pictogram is output or all pictograms are output. I used python because it was easy to generate characters from code points, but I think it can be easily implemented in any language.


The definition of Unicode 6.0 for emoji is here, but it was difficult to extract, so [File Format](http: //www.fileformat.info/info/emoji/list.htm) was used as a reference. Unicode 7.0 adds new emoji, but this is not yet implemented on mac It seemed to be a future issue.

I checked it on Mac, but the emoji was displayed on the default terminal and iTerm2. However, it was not displayed in Emacs24.3.1, iTerm. Also, the emoji was not displayed well even with less. Please let me know if anyone knows how to display it. Also, the emoji on this page will not be displayed on Chrome. If you copy it, the character code is obtained correctly, so it may be a font problem. Please let me know if anyone can understand this.

See you soon.

Recommended Posts

I made a script to display emoji
I made a script to put a snippet in README.md
I made a CUI-based translation script
I made a script to say hello at my Koshien
I made a command to display a colorful calendar in the terminal
〇✕ I made a game
I wrote a script to upload a WordPress plugin
I made a tool to get new articles
I made a script in python to convert .md files to Scrapbox format
I made a program to input what I ate and display calories and sugar
I made a library to separate Japanese sentences nicely
I made a tool to easily display data as a graph by GUI operation.
I made a Python module to translate comment outs
I made a code to convert illustration2vec to keras model
I made a python text
I made a command to markdown the table clipboard
I made a python library to do rolling rank
I made a discord bot
I made a script to record the active window using win32gui of Python
I made a package to filter time series with python
I made a box to rest before Pepper gets tired
I made a command to generate a table comment in Django
I made a tool to create a word cloud from wikipedia
I made a function to check the model of DCGAN
I wrote a script to get a popular site in Japan
I wrote a script to combine the divided ts files
[Titan Craft] I made a tool to summon a giant to Minecraft
I made you to execute a command from a web browser
I made a C ++ learning site
I made a Line-bot using Python!
I made a wikipedia gacha bot
I made a fortune with Python.
I made a daemon with Python
I made a script in Python to convert a text file for JSON (for vscode user snippet)
I made a program to solve (hint) Saizeriya's spot the difference
I made a library to easily read config files with Python
I installed Taiga.IO on CentOS7 (I made a script while I was there)
I made a web server with Raspberry Pi to watch anime
I wrote a script to get you started with AtCoder fast!
I just wrote a script to build Android on another machine
I wrote a function to load a Git extension script in Python
I wrote a script to extract a web page link in Python
I made a library that adds docstring to a Python stub file.
I wrote a script to help goodnotes5 and Anki work together
I tried to create a linebot (implementation)
I made a new AWS S3 bucket
I made a dash docset for Holoviews
I want to print in a comprehension
I tried to create a linebot (preparation)
I touched "Orator" so I made a note
Execute a script from Jupyter to process
I made a character counter with Python
I made Othello to teach Python3 to children (2)
Script example to display BoundingBox with PIL
[Ubuntu] How to execute a shell script
Beginner: I made a launcher using dictionary
How to display emoji on Manjaro Linux
I made Othello to teach Python3 to children (5)
I made a conversation partner like Siri
I want to display the progress bar
I made a Hex map with Python