class Solution(object):
def titleToNumber(self, s):
"""
:type s: str
:rtype: int
"""
count = 0
for i in range(len(s)-1):
count += (ord(s[i])-64) * 26 ** (len(s)-1-i)
return count+(ord(s[-1])-64)
0,比较简单的题目
1,题目要求:
2,其实就是将普通的十进制转换为26进制的形式,用到取ASCII的方法。大写字母与小写字母不同,是从64开始计算的。(A为65)