leetcode Excel Sheet Column Number python
Excel Sheet Column Number
Related to question Excel Sheet Column Title
Given a column title as appear in an Excel sheet, return its corresponding column number.
For example:
A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28
python code
class Solution:
# @param {string} s
# @return {integer}
def titleToNumber(self,s):
ss=list(s)
summ=0
while len(ss)>=1:
num=(ord(ss[0])-64) #26进制
summ=summ*26+num
ss.pop(0)
return summ