PriymakVl
3/9/2020 - 8:17 PM

python string method function

python string method function


'hello'.upper()

'hello'.lower();

'hello'.count('l')
# get 2

'hello'.count('l', start, end)

'hello'.find('e')
# get index 1 if not return -1

'hello'.rfind('e') 
# find start from right side

'hello'.index('e')
# too return index

'hello'.replace('e', '...')

'hello'.isalpha()
# check not number

'123'.isdigital()
# check not symbol

'hello'.rjust(8)
'hello'.ljust(8, '?')
# дополняют строки до указанной длины

'hello world'.split()
# разбивает строку по умолчанию по пробелу

join()
# объединяет в строку

' hello '.strip()
# get 'hello'
rstrip()
lstrip()

s = input().strip().upper()