Skip to main content

PyCountryCode documentation!

What it is?

I have always loved knowing stuff. I love knowledge, it is my first love before anything else. In every kind of setup I find myself in I am always participating because I almost always have an idea about most things. This love of knowledge also made it easy for me to know more country telephone codes.

However, the truth is I couldn't cram them all the country codes and retrieve them from my mind every time it became necessary. I knew by heart those of the most popular countries that includes Russia (+7), UK (+44), USA (+1), Australia (+61) and of course Zimbabwe amongst many others.

Why?

Someone wanted to know what code +52 was for which country, I didn't know, I was embarrassed at myself. I challenged myself by writing this package so I and anyone else can use to get the country calling code of any country and also to get a country after passing in a calling code you know but are not sure about the country of origin.

Inspiration

I wanted to write something that others could find useful.

Installation

$ pip install pycountrycode

Use as per environment

Terminal
$ pip3 install pycountrycode
$ python3
>>> 
Windows Command Prompt
C:\Users\Andile Xeroxzen> pip install pycountrycode
C:\Users\Andile Xeroxzen> python
>>> 

Importing the 'getCode' function

>>> from pycountrycode.countrycode import getCode
>>> getCode('Zimbabwe')
'+263'
>>> getCode('New Zealand')
'+64'
>>> getCode('Peru')
'+51'
>>> getCode('Madagascar')
'+261'
>>> getCode('Russia')
'+7'
>>> getCode('Australia')
'+61'
>>> getCode('Israel')
'+972'
>>> getCode('Mal')
'Undefined country'

Importing the 'getCountry' function.

>>> from pycountrycode.countrycode import getCountry
>>> getCountry('+52')
'Mexico' 
>>> getCountry('+56')
'Easter Island'
>>> getCountry('+1')
'United States of America'
>>> getCountry('+7')
'Russia'
>>> getCountry('+44')
'Britain'
>>> getCountry('+86')
'China'
>>> getCountry('+3')
'Undefined country code'
>>> getCountry('+2')
'Undefined country code'
>>> getCountry('+27')
'South Africa'

Package Information

>>> import pycountrycode
>>> pycountrycode.__author__
'Andile Jaden Mbele'
>>> pycountrycode.__email__
'andilembele020@gmail.com'
>>> pycountrycode.__github__
'www.github.com/xeroxzen/pycountrycode'
>>> pycountrycode.__package__
'pycountrycode'
>>>

Also

>>> from pycountrycode.countrycode import getCode, getCountry
>>> getCode('Botswana')
'+267'
>>> getCountry('+33')
'France'
>>> 

Metadata

Release files for pycountrycode 1.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycountrycode 1.1.6
File Size Uploaded
pycountrycode-1.1.6.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pycountrycode 1.1.6
File Interpreter ABI Platform
pycountrycode-1.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / pycountrycode-1.1.6.tar.gz

Download URL pycountrycode-1.1.6.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6a4f99f6a8b44e2f94ee6ec66a59409d0b93d62eea243ecf3ead94191dc41ca2
BLAKE2b-256 checksum
How to use checksums
6bb65ffb2ccb32cf297f4c5bf5d21373557ca12b7105ec5ad9dbbcf7ec5d4e8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.3

Release files / pycountrycode-1.1.6-py3-none-any.whl

Download URL pycountrycode-1.1.6-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5f58fd443d857fd242749da2eafd0233de5534f048c17113f060bbab4d7c20a
BLAKE2b-256 checksum
How to use checksums
ceab205390843924c5636a5ccc14cda50eb8f9488c0a6344b86c90a13ea0b76a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.3

Release history Release notifications | RSS feed

1.1.8

2 release files

1.1.7

2 release files

This release

1.1.6 This release

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page