Sending args to the print command always puts spaces between them.
Try:
print("Hello {name}!".format(name=name))
2011/7/10 Robert H <[email protected]>
> Dear all,
>
>
> I have Python 3.2 installed on Windows 7. I am a complete beginner playing
> around with the basic functions. My problem is the following script:
>
>
> name="world"
> print("Hello", name,"!")
>
>
> The result is:
> Hello world !
>
>
> However, I don't want the space before the exclamation mark. I want this:
> Hello world!
>
>
> I tried to solve the problem with e.g.:
> print("Hello",name.strip(),"!")
> but the result is the same.
>
>
> Can anyone out there help me? Thank you.
>
>
> Regards,
> Robert
>
> _______________________________________________
> Tutor maillist - [email protected]
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor