[Tutor] Hello World in Python without space

Izz ad-Din Ruhulessin izzaddin.ruhulessin at gmail.com
Sun Jul 10 13:23:11 CEST 2011


Sending args to the print command always puts spaces between them.

Try:
print("Hello {name}!".format(name=name))





2011/7/10 Robert H <hrobert25 at hotmail.com>

>  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  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110710/240e886c/attachment.html>


More information about the Tutor mailing list