leetcode Excel Sheet Column Title python
2015-06-14 07:12
651 查看
Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
class Solution:
# @param {integer} n
# @return {string}
def convertToTitle(self, n):
a=''
while n is not 0:
a+=(chr(((n-1)%26)+65)) #26进制转换问题,跟十进制相似,注意一些细节问题就ok
n=(n-1)/26
return a[-1::-1]
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB python code
class Solution:
# @param {integer} n
# @return {string}
def convertToTitle(self, n):
a=''
while n is not 0:
a+=(chr(((n-1)%26)+65)) #26进制转换问题,跟十进制相似,注意一些细节问题就ok
n=(n-1)/26
return a[-1::-1]
相关文章推荐
- leetcode Largest Number python
- leetcode Majority Element python
- leetcode Word Break python
- python opencv face detection
- Python绘图详解
- Python中使用中文
- Python爬取新闻网标题、日期、点击量
- python操作EXCEL文档
- Python实现打印二叉树某一层的所有节点
- python3.4连接mysql
- Python之Socket传送文件
- 关于python scrapy的安装一个问题 No Moudle named cssselect
- python进程池剖析(二)
- python进程池剖析(一)
- python编程之 Pie游戏
- 找出词频最高的字母
- python进程池剖析(二)
- python写的的语音天气预报
- Python ConfigParser的使用
- Python模块学习:logging 日志记录