version capatibility

Supported Ubuntu and Python Versions

  • Ubuntu 18.04 (bionic) Python2.3 - Python 2.6, Python 3.1 - Python 3.5, Python3.7 - Python3.11
  • Ubuntu 20.04 (focal) Python3.5 - Python3.7, Python3.9 - Python3.11
  • Ubuntu 22.04 (jammy) Python3.7 - Python3.9, Python3.11
  • Note: Python2.7 (all), Python 3.6 (bionic), Python 3.8 (focal), Python 3.10 (jammy) are not provided by deadsnakes as upstream ubuntu provides those packages.

environment

list included modules

$ python -c 'help("modules")'

Please wait a moment while I gather a list of all available modules...

__future__          _warnings           graphlib            runpy
_abc                _weakref            grp                 sched
_aix_support        _weakrefset         gzip                secrets
...

list lib paths

$ python -c 'import sys; print (sys.path)'
['', '/usr/lib/python39.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages']

Positional notation

to Binary

  • Octal to Binary
    >>> bin( int('0o10', 8) )
    '0b1000'
    >>> bin( int('0o17', 8) )
    '0b1111'
    
  • Decimal to Binary
    >>> bin(2)
    '0b10'
    >>> bin(10)
    '0b1010'
    
    • or
      >>> format( 3, 'b' )
      '11'
      >>> format( 15, 'b' )
      '1111'
      
  • Hexadecimal to Binary
    >>> bin( int('a', 16) )
    '0b1010'
    >>> bin( int('f', 16) )
    '0b1111'
    

to Octal

  • Binary to Octal
    >>> oct( int(str(111), 2) )
    '0o7'
    >>> oct( int(str(1000), 2) )
    '0o10'
    
  • Decimal to Octal
    >>> oct(8)
    '0o10'
    
    • or
      >>> format( 15, 'o' )
      '17'
      >>> format( 8, 'o' )
      '10'
      
  • Hexadecimal to Octal
    >>> oct( 0xf )
    '0o17'
    

to Decimal

  • Binary to Decimal
    >>> int( str(11), 2 )
    3
    >>> int( str(1010), 2 )
    10
    
  • Octal to Decimal
    >>> 0o10
    8
    >>> int( 0o10 )
    8
    >>> int ( str(10), 8 )
    8
    
  • Hexadecimal to Decimal
    >>> int( 0xf )
    15
    

to Hexadecimal

  • Binary to Hexadecimal
    >>> hex( int(str(1010), 2) )
    '0xa'
    >>> hex( int(str(1111), 2) )
    '0xf'
    
  • Octal to Hexadecimal
    >>> hex(0o10)
    '0x8'
    >>> hex( int('0o17', 8 ))
    '0xf'
    
  • Decimal to Hexadecimal
    >>> hex(15)
    '0xf'
    >>> hex(66)
    '0x42'
    
    • or
      >>> format( 15, 'x' )
      'f'
      
    • or
      >>> '%x' % 15
      'f'
      

The Big Book of Small Python Projects

[!NOTE|label:references:]

Copyright © marslo 2020-2023 all right reserved,powered by GitbookLast Modified: 2024-05-16 01:41:37

results matching ""

    No results matching ""