[Tutor] spaces in print

Max Noel maxnoel_fr at yahoo.fr
Wed Jan 12 18:24:51 CET 2005


On Jan 12, 2005, at 17:17, kevin parks wrote:

>
>
> when i print:
>
>     print '\n','siday_q', key, '.wav'# event
>
>
> i get:
>
> siday_q 515 .wav
>
>
> how can you eliminate the spaces to get:
>
> siday_q515.wav

	The quick and dirty way is to do:
print '\n' + 'siday_q' + key + '.wav'

	The elegant way is to do use string formatting:
print '\nsiday_q%s.wav' % (key)

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting 
and sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"



More information about the Tutor mailing list