# Analysis of examples of Python common numbering conversion

Source: Internet
Author: User

This article mainly introduces Python common system conversion, examples of binary, octal, decimal and hexadecimal conversion skills, the need for friends can refer to the

1. Rounding System

Binary in Python starts with a 0b:

For example: 0B11 represents 3 of the decimal

The 8 binary starts with 0:

For example: 011 means decimal 9

The 16 binary starts with 0x:

For example: 0x11 represents 17 of the decimal

or write an X-B.

2. Conversion of functions

?

 1, 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 #10进制转为2进制 >>> Bin (a) ' 0b1010 ' #2进制转为10进制 >>> int ("1001", 2) 9 #10进制转为16进制 >>> Hex 0xa ' #16进制到10进制 >>> int (' FF ', "255 >>> int (' 0xAB ') 171 #十进制转为八进制 >>print ("%o "%) > >12 #16进制到2进制 >>> Bin (0xa) ' 0b1010 ' >>> #10进制到8进制 >>> Oct (8) ' 010 ' #2进制到16进制 >>& Gt Hex (0b1001) ' 0x9 '

Related Keywords:
Related Article

## E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

## Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

## Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth \$300-1200 USD