def myAtoi(self, s):
"""
:type s: str
:rtype: int
"""
s = s.strip()
if not s:
return 0
s1=[]
ss = ""
fushu = False
if s[0] == "+" or s[0]=="-" :
ss = s[1:]
if s[0]=="-":
fushu = True
else:
ss = s
for s in ss:
if s>= "0" and s<= "9":
s1.append(s)
else:
break
print(s1)
if len(s1) == 0:
return 0
return min(int("".join(s1)),2**31-1)if fushu==False else max(-int("".join(s1)),-2**31)