String = "My name is Miguel." print(String[::-1])
The join() method takes all items in an iterable and joins them into one string. A string must be specified as the separator.
del String
String = 'I\'m Miguel.' print(String)
String1 = r"This is \x47\x65\x65\x6b\x73 in \x48\x45\x58" print(String1)
# Default order String1 = "{} {} {}".format('Geeks', 'For', 'Life') print("Print String in default order: ") print(String1) # Positional Formatting String1 = "{1} {0} {2}".format('Geeks', 'For', 'Life') print("\nPrint String in Positional order: ") print(String1) # Keyword Formatting String1 = "{l} {f} {g}".format(g='Geeks', f='For', l='Life') print("\nPrint String in order of Keywords: ") print(String1)
# Formatting of Integers String1 = "{0:b}".format(16) print("\nBinary representation of 16 is ") print(String1) # Formatting of Floats String1 = "{0:e}".format(165.6458) print("\nExponent representation of 165.6458 is ") print(String1) # Rounding off Integers String1 = "{0:.2f}".format(1/6) print("\none-sixth is : ") print(String1)