A function is a code block that can implement specific functions. When we call a function, our dream goes into reality, and the function will be implemented. In all programming languages, function implementation is simple: directly call the function name and provide parameters.
In programs, the vast majority of functions need to be written by ourselves. However, in daily work, some functions implemented by functions are very basic and the requirements for results are consistent, these functions are written in advance and can be called directly. We call them "built-in functions ".
For example, the type () function is a built-in function that returns the type of a parameter. When we execute type (23), we will get the result: <type 'int'>, the function reads the 23 type, which is an integer (INT ).
Similarly, we can use built-in functions to convert a string into a number and convert a decimal point into an integer, such:
1 print int(‘32‘)2 print int(3.14)
Of course, not all data can be converted. Just like the following statement, a string cannot be converted into an integer.
1 print int(‘hello‘)
Some may ask, in Python, How do I know which functions I want to use with so many built-in functions? What issues need attention?
The answer is: do not remember. Python has hundreds of built-in functions, which cannot be remembered. It is better to implement it on your own. However, there are some basic and common built-in functions that we can remember after several times, and there is no need to specifically remember them.
Of course, not all data can be converted. Just like the following statement, a string cannot be converted into an integer.
1 print int(‘hello‘)
Some may ask, in Python, How do I know which functions I want to use with so many built-in functions? What issues need attention?
The answer is: do not remember. Python has hundreds of built-in functions, which cannot be remembered. It is better to implement it on your own. However, there are some basic and common built-in functions that we can remember after several times, and there is no need to specifically remember them.
Function call & built-in functions