7 examples of 'parseint in python' in Python

Every line of 'parseint in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
128def parseInt(s):
129 try:
130 return int(s)
131 except ValueError:
132 return 0
20def atoi(s):
21 # python'da bunu yapacak fonksiyon bulamadım
22 # int() sayı olmayan karaktere rastladığında pörtlüyor
23 t = ""
24 for c in s.lstrip():
25 if c in "0123456789":
26 t += c
27 else:
28 break
29 try:
30 ret = int(t)
31 except:
32 ret = 0
33 return ret
10def atoi(s):
11 # python's int() borks when given non integer characters
12 t = ""
13 for c in s.lstrip():
14 if c in "0123456789":
15 t += c
16 else:
17 break
18 try:
19 ret = int(t)
20 except:
21 ret = 0
22 return ret
77def scIntegerParseInt(c, *args):
78 str = c.getParameter("str").getString();
79 c.getReturnVar().setInt(int(str))
20def _to_int(value):
21 if value is None:
22 return 0
23 return int(value)
132def intparse(text):
133 """Parse a command line argument as an integer.
134
135 Accepts 0x and other prefixes to allow other bases to be used."""
136 return int(text, 0)
643def asint(value):
644 """Coerce to integer."""
645
646 if value is None:
647 return value
648 return int(value)

Related snippets