A simple Python program to count emojis in a text file, log file, or user-pasted text using a Tkinter GUI for file selection 🖱️.
- Detects all standard Unicode emojis using the
emojiPython library . - Supports input from:
.txtfiles 📄.logfiles 📝- Directly pasted text ⌨️
- Uses a Tkinter file dialog to select files conveniently .
- Counts both single-character and standard emojis .
- Python 3.7 or higher
- Python packages:
pip install emoji tk
- Works on Windows, macOS, and Linux (Tkinter must be installed).
-
Run the script:
python emoji_counter.py
-
Choose an option from the menu:
1. Text File(.txt) or Log File(.log) 📄 2. Paste Text ⌨️ 3. Exit ❌ -
If Option 1 is selected:
- A file dialog will open to select your
.txtor.logfile 🗂️. - Only files with these extensions are allowed .
- A file dialog will open to select your
-
If Option 2 is selected:
- Paste the text directly into the terminal/console .
-
The program will output the number of emojis in the text .
Given the following text in a file or pasted:
Hello 😀! I love 🍕 and 🏀.
Family time 👨👩👧👦 is the best ❤️.
Output:
The Number Of Emojis In The Provided Data Is 6
- The program counts emojis character by character, so some complex emojis or zero-width joiner sequences are counted individually per character.
- Always use
UTF-8encoded files for proper emoji support 💾.