String Formatting-2
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 | 1. isalpha()-to check whether string has only alphabets -->print('alpha'.isalpha()) -->True 2. isdigit()-to check whether string has only digits -->print('1010'.isdigits()) -->True 3. isspace()-to check whether string has only spaces -->print(' '.isspace()) -->True 4. center()-this will center align the string ,using specified character(space is default) as a fill character -->print('Python'.center(10,'*')) -->**Python** 5. startswith()-to check whether string starts with a particular character(case sensitive) -->print('numpy'.startswith('n')) -->True |