|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
no spaces
How do I force the print not to print spaces?
$ 12343 $ is printed from this line print "$",self.tok,"$" but what I want is $12343$ |
|
#2
|
||||
|
||||
|
Using a formatted string:
print "$%s$"%self.tok See Python docs for more info - Python Library Reference Section 2.3.6.2 Grim ![]()
__________________
*** Experimental Python Markup CGI V2 *** Last edited by Grim Archon : April 10th, 2004 at 03:47 PM. |
|
#3
|
||||
|
||||
|
You can also use the + operator to concatenate the variable in the middle, without the spaces i.e. print '$' + self.tok + '$'. This does however require self.tok to be a string. if it isnt then you will need to type cast the variable using the built-in str() function.
Mark. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > no spaces |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|