String Formatters
Part -1
Dear Readers ,
today I would like to share about string formatter in python and I have them all in this single blog,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # Important string operations-1 1. len()-to evaluate the length of a string -->print(len('sample')) -->6 2. str()-create new string object from given object -->print(type(str(6))) -->'<class 'str'>' 3. lower()-to covert a string to lowercase -->print('HI'.lower()) -->hi 4. upper()-to covert a string to uppercase -->print('hi'.upper()) -->HI 5. strip()-strip the spaces in input there are two subtype's lstrip and rstrip also -->print(' Python '.strip()) -->Python -->print(' Python'.lstrip()) -->Python -->print('Python '.rstrip()) -->Python |