+ 13

Hey! You know there are several ways to do string formatting..

The old one:😑 x = "test string %s" % ("one") The new one:😊 x = "test string {x}".format(x = "one") Literal string interpolation:😀 x = f'test string {"one"}' And by Template String:😏 from string import Template t = Template('test string $var') t.substitute(var="one") print(t) # all outputs will be "test string one" i hope u liked it😀

14th May 2018, 6:50 AM
Abhishek Verma
Abhishek Verma - avatar
5 Antworten
+ 4
Thanks for sharing!
15th May 2018, 10:55 AM
Mayank Rampuriya
Mayank Rampuriya - avatar
+ 2
It's a nice information. thanks for sharing.
19th May 2018, 10:11 AM
Narender Krishna
Narender Krishna - avatar
+ 2
Good info!.. Thanks for sharing. Abhishek Verma
14th Jun 2018, 5:02 PM
Ashi Soni
Ashi Soni - avatar
+ 1
thank you
18th May 2018, 7:33 PM
Hossein Karimian
Hossein Karimian - avatar
+ 1
Ohhh! Nice, good info!
22nd May 2018, 11:56 PM
Mya