While loop - print several times but on 1 line.

Claudio Grondi claudio.grondi at freenet.de
Thu Jan 26 11:55:07 CET 2006


Danny wrote:
> I think I should paste some of the programs code a little more of what I 
> want...
> 
> var = 0
> while var <= 5:
>     print a[t[var]]
>     var = var +1
> 
> a is a dectionary (very big) and t is a string of text. (if that's 
> important right now).
> 
> I'm just trying to make the value of a[t[var]] print on one line if that 
> makes any sense...
> Sorry if I'm not explaining this very well and if my examples aren't 
> very good, I am trying.
I mean that what you are looking for is:
      print a[t[var]],
Notice the last comma in the line above.

Claudio



More information about the Python-list mailing list