| 11 | |
| 12 | == The print() function == |
| 13 | In Python 3, ''print'' is no longer a statement but a function. Using: |
| 14 | {{{ |
| 15 | print "Hello world" |
| 16 | }}} |
| 17 | Will result in syntax error exception. |
| 18 | |
| 19 | The correct way in Python 3 is: |
| 20 | {{{ |
| 21 | print("Hello world") |
| 22 | }}} |
| 23 | |
| 24 | Fortunately, the print function can be used as far back as Python 2.5, so no version specific code is needed for this. All prints just need to be converted to using the print function. This can be easily done automatically using regular expressions or semi-automatically with the ubiquitous search and replace functionality available in most editors. |