Create directories and modify files with Python
Hans Mulder
hansmu at xs4all.nl
Fri May 4 04:11:53 EDT 2012
On 1/05/12 17:34:57, rurpy at yahoo.com wrote:
> from __future__ import print_function #1
>
> ------------------------------------------------------------
>
> #1: Not sure whether you're using Python 2 or 3. I ran
> this on Python 2.7 and think it will run on Python 3 if
> you remove this line.
You don't have to remove that line: Python3 will accept it.
It doesn't do anything in python3, since 'print' is a function
whether or not you include that line, but for backward
compatibility, you're still allowed to say it.
Incidentally, the same is true for all __future__ features.
For example, Python3 still accepts:
from __future__ import nested_scopes
, even though it's only really needed if you're using python
2.1, since from 2.2 onwards scopes have nested with or without
that command.
HTH,
-- HansM
More information about the Python-list
mailing list