Skip to content

Instantly share code, notes, and snippets.

@beniwohli
Created January 4, 2011 19:29
Show Gist options
  • Save beniwohli/765262 to your computer and use it in GitHub Desktop.
Save beniwohli/765262 to your computer and use it in GitHub Desktop.
A Python dictionary mapping the Unicode codes of the greek alphabet to their names
greek_alphabet = {
u'\u0391': 'Alpha',
u'\u0392': 'Beta',
u'\u0393': 'Gamma',
u'\u0394': 'Delta',
u'\u0395': 'Epsilon',
u'\u0396': 'Zeta',
u'\u0397': 'Eta',
u'\u0398': 'Theta',
u'\u0399': 'Iota',
u'\u039A': 'Kappa',
u'\u039B': 'Lamda',
u'\u039C': 'Mu',
u'\u039D': 'Nu',
u'\u039E': 'Xi',
u'\u039F': 'Omicron',
u'\u03A0': 'Pi',
u'\u03A1': 'Rho',
u'\u03A3': 'Sigma',
u'\u03A4': 'Tau',
u'\u03A5': 'Upsilon',
u'\u03A6': 'Phi',
u'\u03A7': 'Chi',
u'\u03A8': 'Psi',
u'\u03A9': 'Omega',
u'\u03B1': 'alpha',
u'\u03B2': 'beta',
u'\u03B3': 'gamma',
u'\u03B4': 'delta',
u'\u03B5': 'epsilon',
u'\u03B6': 'zeta',
u'\u03B7': 'eta',
u'\u03B8': 'theta',
u'\u03B9': 'iota',
u'\u03BA': 'kappa',
u'\u03BB': 'lamda',
u'\u03BC': 'mu',
u'\u03BD': 'nu',
u'\u03BE': 'xi',
u'\u03BF': 'omicron',
u'\u03C0': 'pi',
u'\u03C1': 'rho',
u'\u03C3': 'sigma',
u'\u03C4': 'tau',
u'\u03C5': 'upsilon',
u'\u03C6': 'phi',
u'\u03C7': 'chi',
u'\u03C8': 'psi',
u'\u03C9': 'omega',
}
@benjaminmgross
Copy link

Great post, very helpful, thank you!

@SheilaRT
Copy link

Nice gist, though if you ever want more than just the greek alphabet or more than just the python way of including codepoints, I've created a repo named 'Azure Alphant' which should be helpful. I can definitely appreciate what you were doing with this, though.

@fishwithlaser
Copy link

this is super! I feel like the opposite of this would be more useful (at least for me)! (e.g., {'Alpha': u'\u0391',... )

@beniwohli
Copy link
Author

@fishwithlaser you can easily invert the dictionary like so:

greek_alphabet_inv = {v: k for k, v in greek_alphabet.items()}

Note that this only works because there is a 1:1 relation between keys and values. If there were multiple keys with the same value, you'd lose data.

@Johny-Leo
Copy link

Awesome! Thank you! I broke it into 2 variables for upper and lower cases.

@jxshen311
Copy link

Thanks! A big saver!

@shrikantcombio
Copy link

Awesome!, Very helpful, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment