Simplifies the encoding and decoding of Regional Indicator Symbols.
RISify is a Python library that provides functions for encoding and decoding
Regional Indicator Symbols (RIS), which are Unicode characters used to
represent flags of countries and regions.
You can install
RISify via pip:
pip install RISify
from ris import ris # decode a country code to RIS pt = ris("PT") print(pt) # 🇵🇹 # decode an HTML code to RIS de = ris("🇩🇪") de = de.encode("unicode") # default print(de) # 🇩🇪 # encode a RIS code to uppercase ASCII nl = ris("🇳🇱") nl = nl.encode("ascii") nl = nl.upper() # default print(nl) # NL # encode a RIS code to lowercase ASCII eu = ris("🇪🇺") eu = eu.encode("ascii") eu = eu.lower() print(eu) # eu # encode a RIS code to HTML fo = ris("🇫🇴") fo = fo.encode("html") print(fo) # 🇫🇴 # concatenate RIS codes into a string print("spam " + pt + " bacon " + de + " sausage " + nl + " eggs " + eu + " ham " + fo) # spam 🇵🇹 bacon 🇩🇪 sausage NL eggs eu ham 🇫🇴
Note that HTML is encoded with HTML-safe symbols, which can be useful for ensuring that the symbols are markup-safe when used in HTML.
Contributions are welcome! If you find a bug or have an idea for a new feature, please open an issue on the GitLab repository. If you would like to contribute code, please fork the repository and submit a pull request.
RISify is released under the GPLv3 license. See LICENSE for
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.