String exchange functions in Python
Python provides a lot of built-in functions for manipulating strings. String in Python is immutable, so all these functions return a new string and the original string remains unchanged. You do not have to memorize all of these functions that we will mention in this article. All you have to know is how to use these functions and what they can do. All of these functions are present by default in the str class inside the builtins.py file, which is included in the Python interpreter.
name | description | URL |
---|---|---|
replace() | The replace() function returns a new copy of the string in which all occurrences of the substring are replaced by another substring. It can also specify how often substrings should be replaced by another substring. | read more |
maketrans() | The maketrans() function returns a transposition table that transposes each character in the first string to the character in the second string at the same position. | read more |
format() | The format() function formats complex strings more efficiently. By placing one or more surrogate fields inside a pair of curly braces {} in a string and calling the value we wish to put and concatenating it to the string. | read more |
Tags
Python python data types Python String string methods python python string replace method python string translate and maketrans method python string format method String exchange functions in Python
Share page
About author
Ahmed Obaid
Hello, I am Ahmed Obaid, an Egyptian Arabic programmer. I would like to put my experiences learning Python on this site So that it will be a reference for you and me as well.
Sign up to leave a comment