How to find the unicode of the subscript alphabet?

后端 未结 3 1870
深忆病人
深忆病人 2020-11-27 11:34

I\'ve found some letters but i need to find others such as \"c\", \"m\", \"p\", is this even possible?

相关标签:
3条回答
  • 2020-11-27 12:25
    import sys
    # on windows run from QtConsole for unicode
    #  (Cmd console only support codepage characters)
    #  At present (6/10/2017), superscripts/subscript chars
    #  are best viewed with terminal/text-editor set to monospace font
    #       "DejaVu Sans Mono"
    #  "Consolas" works also, but is missing a few characters...
    #  and, "Courier" has the worst support at present...
    
    if int(sys.version[0]) != 3:
        print('Aborted: Python 3.x required')
        sys.exit(1)
    
    def table():
        unicode_map = {
             #           superscript     subscript
            '0'        : ('\u2070',   '\u2080'      ),
            '1'        : ('\u00B9',   '\u2081'      ),
            '2'        : ('\u00B2',   '\u2082'      ),
            '3'        : ('\u00B3',   '\u2083'      ),
            '4'        : ('\u2074',   '\u2084'      ),
            '5'        : ('\u2075',   '\u2085'      ),
            '6'        : ('\u2076',   '\u2086'      ),
            '7'        : ('\u2077',   '\u2087'      ),
            '8'        : ('\u2078',   '\u2088'      ),
            '9'        : ('\u2079',   '\u2089'      ),
            'a'        : ('\u1d43',   '\u2090'      ),
            'b'        : ('\u1d47',   '?'           ),
            'c'        : ('\u1d9c',   '?'           ),
            'd'        : ('\u1d48',   '?'           ),
            'e'        : ('\u1d49',   '\u2091'      ),
            'f'        : ('\u1da0',   '?'           ),
            'g'        : ('\u1d4d',   '?'           ),
            'h'        : ('\u02b0',   '\u2095'      ),
            'i'        : ('\u2071',   '\u1d62'      ),
            'j'        : ('\u02b2',   '\u2c7c'      ),
            'k'        : ('\u1d4f',   '\u2096'      ),
            'l'        : ('\u02e1',   '\u2097'      ),
            'm'        : ('\u1d50',   '\u2098'      ),
            'n'        : ('\u207f',   '\u2099'      ),
            'o'        : ('\u1d52',   '\u2092'      ),
            'p'        : ('\u1d56',   '\u209a'      ),
            'q'        : ('?',        '?'           ),
            'r'        : ('\u02b3',   '\u1d63'      ),
            's'        : ('\u02e2',   '\u209b'      ),
            't'        : ('\u1d57',   '\u209c'      ),
            'u'        : ('\u1d58',   '\u1d64'      ),
            'v'        : ('\u1d5b',   '\u1d65'      ),
            'w'        : ('\u02b7',   '?'           ),
            'x'        : ('\u02e3',   '\u2093'      ),
            'y'        : ('\u02b8',   '?'           ),
            'z'        : ('?',        '?'           ),
            'A'        : ('\u1d2c',   '?'           ),
            'B'        : ('\u1d2e',   '?'           ),
            'C'        : ('?',        '?'           ),
            'D'        : ('\u1d30',   '?'           ),
            'E'        : ('\u1d31',   '?'           ),
            'F'        : ('?',        '?'           ),
            'G'        : ('\u1d33',   '?'           ),
            'H'        : ('\u1d34',   '?'           ),
            'I'        : ('\u1d35',   '?'           ),
            'J'        : ('\u1d36',   '?'           ),
            'K'        : ('\u1d37',   '?'           ),
            'L'        : ('\u1d38',   '?'           ),
            'M'        : ('\u1d39',   '?'           ),
            'N'        : ('\u1d3a',   '?'           ),
            'O'        : ('\u1d3c',   '?'           ),
            'P'        : ('\u1d3e',   '?'           ),
            'Q'        : ('?',        '?'           ),
            'R'        : ('\u1d3f',   '?'           ),
            'S'        : ('?',        '?'           ),
            'T'        : ('\u1d40',   '?'           ),
            'U'        : ('\u1d41',   '?'           ),
            'V'        : ('\u2c7d',   '?'           ),
            'W'        : ('\u1d42',   '?'           ),
            'X'        : ('?',        '?'           ),
            'Y'        : ('?',        '?'           ),
            'Z'        : ('?',        '?'           ),         
            '+'        : ('\u207A',   '\u208A'      ),
            '-'        : ('\u207B',   '\u208B'      ),
            '='        : ('\u207C',   '\u208C'      ),
            '('        : ('\u207D',   '\u208D'      ),
            ')'        : ('\u207E',   '\u208E'      ),        
            ':alpha'   : ('\u1d45',   '?'           ), 
            ':beta'    : ('\u1d5d',   '\u1d66'      ), 
            ':gamma'   : ('\u1d5e',   '\u1d67'      ), 
            ':delta'   : ('\u1d5f',   '?'           ), 
            ':epsilon' : ('\u1d4b',   '?'           ), 
            ':theta'   : ('\u1dbf',   '?'           ),
            ':iota'    : ('\u1da5',   '?'           ),
            ':pho'     : ('?',        '\u1d68'      ),
            ':phi'     : ('\u1db2',   '?'           ),
            ':psi'     : ('\u1d60',   '\u1d69'      ),
            ':chi'     : ('\u1d61',   '\u1d6a'      ),
            ':coffee'  : ('\u2615',   '\u2615'      )
        }
    
        keys = sorted(unicode_map.keys())
    
        for key in keys:
            spr = "X" + unicode_map[key][0] 
            sub = "X" + unicode_map[key][1]        
            if (spr == "X?"): spr = ""
            if (sub == "X?"): sub = ""
            print('%-15s %s %s' % (key, spr, sub))
    
    table()
    
    0 讨论(0)
  • 2020-11-27 12:30

    Take a look at the wikipedia article Unicode subscripts and superscripts. It looks like these are spread out across different ranges, and not all characters are available.

    Consolidated for cut-and-pasting purposes, the Unicode standard defines complete sub- and super-scripts for numbers and common mathematical symbols ( ⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁺ ⁻ ⁼ ⁽ ⁾ ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₊ ₋ ₌ ₍ ₎ ), a full superscript Latin lowercase alphabet except q ( ᵃ ᵇ ᶜ ᵈ ᵉ ᶠ ᵍ ʰ ⁱ ʲ ᵏ ˡ ᵐ ⁿ ᵒ ᵖ ʳ ˢ ᵗ ᵘ ᵛ ʷ ˣ ʸ ᶻ ), a limited uppercase Latin alphabet ( ᴬ ᴮ ᴰ ᴱ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴼ ᴾ ᴿ ᵀ ᵁ ⱽ ᵂ ), a few subscripted lowercase letters ( ₐ ₑ ₕ ᵢ ⱼ ₖ ₗ ₘ ₙ ₒ ₚ ᵣ ₛ ₜ ᵤ ᵥ ₓ ), and some Greek letters ( ᵅ ᵝ ᵞ ᵟ ᵋ ᶿ ᶥ ᶲ ᵠ ᵡ ᵦ ᵧ ᵨ ᵩ ᵪ ). Note that since these glyphs come from different ranges, they may not be of the same size and position, depending on the typeface.

    0 讨论(0)
  • 2020-11-27 12:30

    You can copy the characters from the Wikipedia page mentioned in the other answer. Then in python

    characters = '⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁺ ⁻ ⁼ ⁽ ⁾ ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₊ ₋ ₌ ₍ ₎ ᵃ ᵇ ᶜ ᵈ ᵉ ᶠ ᵍ ʰ ⁱ ʲ ᵏ ˡ ᵐ ⁿ ᵒ ᵖ ʳ ˢ ᵗ ᵘ ᵛ ʷ ˣ ʸ ᶻ ᴬ ᴮ ᴰ ᴱ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴼ ᴾ ᴿ ᵀ ᵁ ⱽ ᵂ ₐ ₑ ₕ ᵢ ⱼ ₖ ₗ ₘ ₙ ₒ ₚ ᵣ ₛ ₜ ᵤ ᵥ ₓ ᵅ ᵝ ᵞ ᵟ ᵋ ᶿ ᶥ ᶲ ᵠ ᵡ ᵦ ᵧ ᵨ ᵩ ᵪ'
    for c in characters.split():
        print(c + '=' + hex(ord(c)))
    

    ⁰=0x2070 ¹=0xb9 ²=0xb2 ³=0xb3 ⁴=0x2074 ⁵=0x2075 ⁶=0x2076 ⁷=0x2077 ⁸=0x2078 ⁹=0x2079 ⁺=0x207a ⁻=0x207b ⁼=0x207c ⁽=0x207d ⁾=0x207e

    ₀=0x2080 ₁=0x2081 ₂=0x2082 ₃=0x2083 ₄=0x2084 ₅=0x2085 ₆=0x2086 ₇=0x2087 ₈=0x2088 ₉=0x2089 ₊=0x208a ₋=0x208b ₌=0x208c ₍=0x208d ₎=0x208e

    ᵃ=0x1d43 ᵇ=0x1d47 ᶜ=0x1d9c ᵈ=0x1d48 ᵉ=0x1d49 ᶠ=0x1da0 ᵍ=0x1d4d ʰ=0x2b0 ⁱ=0x2071 ʲ=0x2b2 ᵏ=0x1d4f ˡ=0x2e1 ᵐ=0x1d50 ⁿ=0x207f ᵒ=0x1d52 ᵖ=0x1d56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