File: _common.py

package info (click to toggle)
python-tabledata 1.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 300 kB
  • sloc: python: 1,406; makefile: 69; sh: 5
file content (12 lines) | stat: -rw-r--r-- 274 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""


def convert_idx_to_alphabet(idx: int) -> str:
    if idx < 26:
        return chr(65 + idx)

    div, mod = divmod(idx, 26)

    return convert_idx_to_alphabet(div - 1) + convert_idx_to_alphabet(mod)