Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

1002 B
Raw Blame

title: Python int() built-in function - Python Cheatsheet description: Return an integer object constructed from a number or string x, or return 0 if no arguments are given.

Python int() built-in function From the Python 3 documentation Return an integer object constructed from a number or string x, or return 0 if no arguments are given.

Examples

>>> # transform a string to an integer
>>> from_integer = int('29')
>>> from_integer
# 29
>>> type(from_integer)
# <class 'int'>

>>> # transform a float to integer
>>> from_float = int(-3.14)
>>> from_float
# -3
>>> type(from_float)
# <class 'int'>

>>> # return an empty string
>>> int()
# 0