python - 将电子表格编号转换为列字母

标签 python

最佳答案

start_index = 1   #  it can start either at 0 or at 1
letter = ''
while column_int > 25 + start_index:   
    letter += chr(65 + int((column_int-start_index)/26) - 1)
    column_int = column_int - (int((column_int-start_index)/26))*26
letter += chr(65 - start_index + (int(column_int)))

关于python - 将电子表格编号转换为列字母,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23861680/

相关文章:

python - 我可以使用 Python argparse 根据需要设置 stdin 吗?

python - 格式化 datetime.utcnow() 时间

python - 提取 keras 模型的最后一层作为子模型

python - 如何解释这三个python代码的执行结果呢?

python - 如何找到两个目录之间的相对路径?

python - 具有先前预处理数据的 TFIDF

python - 无法在 css 中应用背景图片( flask 模板)

python - 转换 pandas.DataFrame 中的元组列表

python - 将 sys.stdout 重定向到 python 日志记录

python - 将 input_dim 传递给 KerasClassifier(sklearn 包装器/接口(interface))