day-8 plastic magic

! # / User / bin / the env / Python 
# - * - Coding: UTF-. 8 - * -
# convert the string to int (numeric) numeric string type to avoid an error
A = '123'
Print (type ( a), a)
B = int (a)
Print (type (B))

#base: the n-ary form num conversion
num = '0x11'
V = int (num, Base = 16) # 16 for hexadecimal ary
Print (V)

#bit_lenght current digital binary represented at least by several
Age = 10
#. 1. 1
# 2 10
#. 11. 3
#. 4 100
# 101. 5
# 110. 6
V2 = age.bit_length ()
Print (V2)

Guess you like

Origin www.cnblogs.com/pythonzhao/p/11701232.html