4 ms·
There are a bunch of these. There's the Python 2 specific string formatting as well: # Input, assignment >>> name = input('What is your name?\n') >
by lelandbatey 13y ago
There are a bunch of these. There's the Python 2 specific string formatting as well:
# Input, assignment
>>> name = input('What is your name?\n')
>>> print 'Hi, %s.' % name
Why so Python 2 specific? Why not Python 3? : (
- koenigdavidmj 13y agoHowever, they also used an example showing that integer division returns a float, which is a behaviour specific to Python 3.
- cma 13y agoNot completely, this has been available in python 2 for a long time: >>> from __future__ import division
- alcari 13y ago%-based string interpolation still works in python 3.
- lelandbatey 13y agoHuh, you're right. I could have sworn it was taken out in favor of '.format'; I wonder where I got that idea from...?
- andreasvc 13y ago% formatting is not Python 2 specific, plans to remove it from 3 have been deferred.