Conversion between Python data types
Conversion between Python data types
Description | |
---|---|
int(x [,base]) |
Convert x to an integer |
long(x [,base] ) | Convert x to a long integer |
float(x) | Convert x to a floating point number |
complex(real [,imag]) | Create a complex number |
str(x) |
Convert object x to string |
| Convert object x to an expression string|
Use to evaluate a valid Python expression in a string and return an object | |
Convert sequence s into a tuple | |
Convert sequence s into a list | |
Convert to a variable set | |
Create a dictionary. d must be a sequence of (key, value) tuples. | |
Convert to immutable collection | |
Convert an integer to a character | |
Convert an integer to Unicode characters | |
Convert a character to its integer value | |
Convert a Convert an integer to a hexadecimal string | |
Convert an integer to a Octal string |
a=3
import typestype(a)int(a) #Convert to integer typestr(a) #Convert to string Python math function
abs(x) | |
---|---|
ceil(x) | |
cmp(x, y) | |
exp(x) | |
fabs(x) | |
floor(x) | |
log(x) | |
log10(x) | |
max(x1, x2,...) | |
min(x1, x2,...) | |
modf(x) | |
pow(x, y) | |
round(x [,n]) | |
sqrt(x) | |
choice(seq) | |
---|---|
randrange ([start,] stop [,step]) | |
random() | |
seed([x]) | |
shuffle(lst) | |
uniform(x, y) | |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

When using Python's pandas library, how to copy whole columns between two DataFrames with different structures is a common problem. Suppose we have two Dats...

How to teach computer novice programming basics within 10 hours? If you only have 10 hours to teach computer novice some programming knowledge, what would you choose to teach...

In Python, how to dynamically create an object through a string and call its methods? This is a common programming requirement, especially if it needs to be configured or run...

How does Uvicorn continuously listen for HTTP requests? Uvicorn is a lightweight web server based on ASGI. One of its core functions is to listen for HTTP requests and proceed...

The article discusses popular Python libraries like NumPy, Pandas, Matplotlib, Scikit-learn, TensorFlow, Django, Flask, and Requests, detailing their uses in scientific computing, data analysis, visualization, machine learning, web development, and H

Fastapi ...

How to avoid being detected when using FiddlerEverywhere for man-in-the-middle readings When you use FiddlerEverywhere...
