一定注意空格啥的,被折腾死了,tab不等于空格
class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
maxi = pow(2,31)
p = abs(x)
q = abs(x)
t = 0
while p>0:
t = t * 10 + p%10
if t > maxi:
return 0
p = p/10
if x == q:
return t
return (-1)*t