Tip: Python Variables and Typing
Join the DZone community and get the full member experience.
Join For FreeNever forget, Python uses duck typing and has typed objects but untyped variable names.
How to know the type of variables:
Source: http://glowingpython.blogspot.com/2011/04/variables-and-typing.html
lfc = "Liverpool" # this is a string manc = "Manchester City" l_score = 3 # this is a integer m_score = 0 print "Result",lfc,l_score,"-",m_score,manc Result Liverpool 1 - 0 Manchester City
How to know the type of variables:
type(lfc) <type 'str'=""> type(l_score) <type 'int'="">
Source: http://glowingpython.blogspot.com/2011/04/variables-and-typing.html
Python (language)
Typing
Opinions expressed by DZone contributors are their own.
Comments