这是在提供行和列ID时提供COLUMN名称的代码,但是当我给出类似值时row = 1 and col = 104,它应该返回CZ,但它返回D@
row = 1
col = 104
div = col
column_label = str()
while div:
(div, mod) = divmod(div, 26)
column_label = chr(mod + 64) + column_label
print column_label
Run Code Online (Sandbox Code Playgroud)
我在做什么有什么问题?
(此代码参考EXCEL列,其中我提供了行,列ID值并期望ALPHABETIC值相同.)