Pillole di Python

Post date: Jan 9, 2015 8:25:07 AM

Clear screeen

import os os.system('cls')

Installazione package con PIP

import pip pip.main(['install','package'])

Decimal to bytes

"{0:b}".format(7)

Hex to decimal

Decimal to HEX

int("FF",16)

# Method 1 hex(58).split('x')[1].upper() # = '3A' # Method 2 '{0:X}'.format(58) # = '3A' # A function to simplify your life d = lambda f : '{0:x}'.format(int(f)).upper() d(58) # = '3A'

Aggiornamento di tutti i pacchetti Python

pip install pip-review pip-review --local --interactive