罗马数字转整数

#encoding=utf-8
class Solution(object):
    def romToInter(self, s):
        '''

        :param s: str
        :return: int
        '''
        roman_tuple = ['M','D','C','L','X','V','I']
        num_tuple = [1000,500,100,50,10,5,1]
        merge_dic = dict(zip(roman_tuple,num_tuple))
        num = 0
        for i in range(len(s)-1):
            if merge_dic[s[i]]

你可能感兴趣的:(罗马数字转整数)