+ 2

How can I remove spaces between those braces and hyphen?

https://code.sololearn.com/c0tZBR9669I2/?ref=app In this code

1st Nov 2018, 2:36 PM
Abdul S Ansari
Abdul S Ansari - avatar
4 Antworten
+ 5
Use a format string! x = 5 print(f'({x})') The {} are the spot where x is inserted, and the {} themselves are not printed, so you get: (5) You can also do it like this: print('{}+{}={}'.format(2, 4, 2+4))
1st Nov 2018, 2:47 PM
HonFu
HonFu - avatar
+ 4
use the sep keyword argument in print: print(..., sep="") # no spaces between seperations
1st Nov 2018, 3:04 PM
jtrh
jtrh - avatar
+ 3
As an alternate suggestion, use “+” signs to separate the different sections of your print statement rather than commas, e.g., print(“(“ + num[:10] + “)”)
1st Nov 2018, 3:20 PM
Russ
Russ - avatar