Skip to content

Instantly share code, notes, and snippets.

@righ
Created October 20, 2017 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save righ/559b7710af88065085fe54211c239552 to your computer and use it in GitHub Desktop.
Save righ/559b7710af88065085fe54211c239552 to your computer and use it in GitHub Desktop.
Excelの列名変換
from string import ascii_uppercase
def to_column(number):
"""
:param int number: 1以上の数値
"""
string = ''
while True:
number -= 1
string = ascii_uppercase[number % 26] + string
number //= 26
if not number:
return string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment