DEV Community

A K I L A N
A K I L A N

Posted on

Python In Bulit String methods

  1. casefold(): Casefold will convert capital alpha to small alpha
txt = "Hello, My Name is AKILAN"
txt2 = "I  AM IRONMAN"
x = txt.casefold()
y= txt2.casefold()
print(x)
print(y)

Enter fullscreen mode Exit fullscreen mode

OUTPUT

hello, my name is akilan
i  am ironman

Enter fullscreen mode Exit fullscreen mode
  1. swapcase(): swapcase will convert uppercase into lowercase and lower to upper
txt = "hello, my name is akilan"
txt2 = "I  AM IRONMAN"
x = txt.swapcase()
y= txt2.swapcase()
print(x)
print(y)


Enter fullscreen mode Exit fullscreen mode

output

HELLO, MY NAME IS AKILAN
i  am ironman

Enter fullscreen mode Exit fullscreen mode
  1. strip()
    strip will defaultly remove starting and ending white space if anything not given .

  2. lstrip()

  3. rstrip()

  4. isspace()

  5. isalnum()

  6. isnumeric()

  7. isdigit()

Top comments (0)