Reply
Thread Tools
Posts: 19 | Thanked: 0 times | Joined on Sep 2011
#1
Hi! I am studying & familiarizing Python (again) through reading "Head First Python" book on the go using Nokia N900's Python 2.5.4, vim and evince. I most of the time can only study at the moment besides weekends during my relatively long trips going to and from work.

I'm at the moment stomped with the line:
Code:
print("\t", end=' ')
As that is available only at Python 3.0 which the book I'm faithfully following as possible instructed. I tried googling about it and all I found is using
Code:
from __future__ import print_function
but honestly, that did not work and still returns an error of invalid syntax.

Would it be alright to ask what would be the best solution or counterpart of that syntax in Python 2.5.4?

Thank you in advance

PS: Yes, one of the reasons I'm learning Python is for development also in the N900 (which I eventually want to build a Plurk client). Sadly, I'm mostly crunching my little free time and can only study during the time I'm traveling.

PPS: I also apologize if I posted this in the wrong section. Kindly move if necessary.
 
Posts: 324 | Thanked: 371 times | Joined on Dec 2009 @ Vancouver, BC
#2
See:
http://docs.python.org/release/3.0.1/whatsnew/3.0.html

Old: print x, # Trailing comma suppresses newline
New: print(x, end=" ") # Appends a space instead of a newline
 

The Following User Says Thank You to Slocan For This Useful Post:
Posts: 19 | Thanked: 0 times | Joined on Sep 2011
#3
Thanks Slocan! That worked

Darn. My google-fu fails me OTL
 
Reply


 
Forum Jump


All times are GMT. The time now is 10:35.