摘要: 错误记录 class Solution: def romanToInt(self, s: str) -> int: d = {'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000} r=0 for i in range(len(s)): if d[s[ 阅读全文
posted @ 2019-03-09 18:06 oldby 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题目描述 方法一:转换为字符串 class Solution: def isPalindrome(self, x: int) -> bool: if x<0: return False else: y=str(x)[::-1] return y==str(x) 方法二;数字反转 class Solu 阅读全文
posted @ 2019-03-09 17:19 oldby 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Python join()方法 join()方法语法: str.join(sequence) 参数 sequence -- 要连接的元素序列。 返回值 返回通过指定字符连接序列中元素后生成的新字符串。 实例 #!/usr/bin/python # -*- coding: UTF-8 -*- str 阅读全文
posted @ 2019-03-09 16:42 oldby 阅读(225) 评论(0) 推荐(0) 编辑