phone-format is a Python library for dealing with formatting phone numbers.
Use the package manager pip or poetry to install rwandaphoneformat.
pip install phone_format
or
poetry add phone_format
from phone_format.format_phone import RwandaPhoneFormat
# returns '250780000000'
RwandaPhoneFormat.format_phone('0780000000')
# returns '250780000000'
RwandaPhoneFormat.format_phone('+250780000000')
# returns '250780000000'
RwandaPhoneFormat.format_phone('780000000')
# returns '250780000000'
RwandaPhoneFormat.format_phone('250780000000')
# returns '1', here it returns the input,
# if the input is not formatted as a Rwandan phone
RwandaPhoneFormat.format_phone('1')
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.