Privacy policy
Python tuple packing and unpacking python tuple can also be created without using a tuple() class or enclosing the items inside the parentheses. it is called the variable packing #python tuple packing into tuple tuple=23,44,66,'django' print(tuple) print(type(tuple)) #unpacking tuple into variable a,b,c,d=tuple print("a is =",a) print("b is =",b) print("c is =",c) print("d is =",d) print(type(a)) print(type(b)) print(type(c)) print(type(d)) output : (23, 44, 66, 'django') <class 'tuple'> a is = 23 b is = 44 c is = 66 d is = django <class 'int'> <class 'int'> <class 'int'> <class 'str'>
Comments
Post a Comment