"The Format Method" Format not working to change strings.

Format is not doing its job? what am I doing wrong?

Example.

age = 20
name = "Swaroop"
print '() was () years old when he wrote this book'.format(name, age)
print 'Why is () playing with that python?'.format(name)

After running it looks like...


/usr/bin/python2.7 /home/rampart/PycharmProjects/helloworld/str_format_py.py
() was () years old when he wrote this book
Why is () playing with that python?

Process finished with exit code 0

Please sign in to leave a comment.