python - Remove whitespace in print function -
python - Remove whitespace in print function -
this question has reply here:
how print variables without spaces between values 4 answersi have code
print "/*!",your_name.upper(),"*/";
where your_name info user inputs.
how can edit code above tell scheme remove whitespace?
update:
if print code, i'll /*! your_name */
i want remove whitspaces between /*! your_name */
the spaces inserted print
statement when pass in multiple expressions separated commas. don't utilize commas, build one string, pass in 1 expression:
print "/*!" + your_name.upper() + "*/"
or utilize string formatting str.format()
:
print "/*!{0}*/".format(your_name.upper())
or older string formatting operation:
print "/*!%s*/" % your_name.upper()
or utilize print()
function, setting separator empty string:
from __future__ import print_function print("/*!", your_name.upper(), "*/", sep='')
python
Comments
Post a Comment