** String.format (argument, argument, ...) **
ex) >>> a ='{} has the same meaning as {}'
a.format ('immediately','immediately') 'Immediately the same as immediately'
# # ** String.format (0 arguments, 1, ...) ** By numbering, the same value can be displayed many times. ex) >>> a ='{0} has the same meaning as {1}. {0} and {1} have the same meaning as {2}'
a.format ('immediately','immediately','immediately') 'Immediately has the same meaning. Immediately and immediately has the same meaning as'immediately'
# #
Find the old string in the string, create a string replaced with the new string, and return it ** String.replace (old string, new string) **
ex) >>> guest ='Saito, Suzuki, Tanaka'
guest.replace (',', like,') ** Mr. Saito, Mr. Suzuki, Mr. Tanaka
** String.replace (old string, new string, number of times) ** Searches the old character string from the character string for the specified number of times, creates a character string replaced with the new character string, and returns it. ex) >>> guest ='Saito, Suzuki, Tanaka'
guest.replace (',', like,', 1) ** Mr. Saito, Suzuki, Tanaka
Recommended Posts