osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

print without ()


Hello,

Sometimes I find code with strange print function usage. String is passed without brackets.

#!/usr/bin/python
list = ['physics', 'chemistry', 1997, 2000];
print "Value available at index 2 : "
print list[2]
list[2] = 2001;
print "New value available at index 2 : "
print list[2]

If I use command print "aaa" in console I get error. So, why this is allowed in sample?

Sample from:
https://www.tutorialspoint.com/python/python_lists.htm