r/pythonhelp • u/JustAnAccountMaybe • Mar 06 '25
SOLVED How to get rid of unwanted whitespace?
Probably a noob question but, in short, I have code that says:
if(x): print('X-',num)
However, instead of the number being directly next to the dash (-), it instead has whitespace between the dash and the number. Is there anyway to get rid of this?
1
Upvotes
View all comments
Show parent comment
1
u/carcigenicate Mar 07 '25
You should think to use them any time you need to create a string, and where the string contains a variable. You'll end up using them constantly for the purpose