- Strip (Trim)
- Concat
Concatenation
print("Hello" + " " + "World")
.join()
- Search
To check the existance of a text in another text
- Mapping
.format()
.format_map()
.translate(), .maketrans()
- Split
To break a text into multiple parts
- Formatting
- Change Case
.capitalize()
.lower()Convert all letters to lowercase
.upper()Convert all letters to uppercase
.title()Convert the first letter of all words in a sentence to capital letters
.swapcase()Convert uppercase letters to lowercase letters and vice versa
.casefold()Works like the
.lower()method, but more powerful and works for other languages like German.
- Direction
- Change Case
- Checking
To check the character status of a text. For example, whether all are written in capital or small letters, or whether the characters are numeric or not?
- Check Formatting
.istitle()Do all the words of a text start with capital letters or not?
.islower()Are all the letters of a text small?
.isupper()Are all the letters of a text capital?
- Check Alpha
- Check Number
- Check Other
- Check Formatting
- Encode
- Other
Multi-line text
Loop over characters
ReverseReverse a text; for example to change
HellotoolleH
len()Counting the total number of characters in a text. In fact, the size of a text.
.count()Counting the number of occurrences of a specific character in a text
.replace()Change part of a string with another text
.zfill()Put zeros before a text something like this:
000000000000000hello
.expandtabs()Default tab is 4 spaces but we can expand it
- Scape Chars
This repository was archived by the owner on Aug 11, 2023. It is now read-only.