Python Tricks

These are the Python useful tricks.

Swapping two variables

swapping variables

Show decimal number in hex, octal and binary form

hex, octal, binary values

Expand the string to array of chars.

expand the string

Found value inside multiple variables

search variables

Function returning tuple

return tuple

Reverse the order of elements

reverse order of elements

Get just the unique values in a list

get the unique list values

tags: tricks & category: python