Python Strings

In this Section of we will be focusing towards strings in python. This Python strings learning ranges from beginner to intermediate and to advanced level. Lets get started with python strings Learning.

python basics tutorial

1) Remove Space in Python

Remove space in python string / strip space in python string : In this section we will learn how to remove or strip leading , trailing and duplicate spaces in python  with lstrip() , rstrip() and strip() Function

 

2) Add Spaces in Python

Add spaces in python with example : In this Section we will learn how to add Spaces (leading, Trailing Spaces to string) in python

 

3) Encode and Decode string in python

In this section we will learn how to encode and decode string in python. We will be using encode() function to encode a string in python. We will be using decode() function to decode a string in python.

 

4) Find() Function in Python

In this section we will be learning how to find the position of the substring with the help of Find() function in python with an example.

 

5) isalnum() Function in python

isalnum() Function in python checks whether the string consists of alphanumeric characters.

 

6) isalpha() Function in python

isalpha() Function in python checks whether the string consists of alphabetic characters.

 

7) isdigit() Function in python

isdigit() Function in python checks whether the string consists of numeric digits only.

 

8) islower() Function in Python

islower() Function in python checks whether the string consists of lowercase only.

 

9) isupper() Function in Python

isupper() Function in python checks whether the string consists of uppercase only.

 

10) istitle() Function in Python

istitle() Function in python checks whether the string consists of titlecase or proper case only.

 

11) isspace() Function in Python

isspace() Function in python checks whether the string consists of only space.

 

12)  len() function in python

len() function in python gets the length of the string

 

13) Padding with ljust(),rjust() and center() function in python

ljust() ,rjust() and center() function in python returns the string with padding done on the right end, left end and both the end of the string

 

14) lower() upper() & title() function in python

lower(),upper() & title() Function in python converts the input string to lower case, upper case and proper case.

 

15) String max() and string min() function in python

String max() Function, String max() Function in python returns the maximum alphabetical character and minimum alphabetical character

 

16) Strip with with lstrip(),rstrip() and strip() function in python

lstrip () ,rstrip() and strip() function in python removes the leading spaces, trailing spaces and all the spaces of the string respectively.

 

17) swapcase() Function in Python

swapcase() Function in python swaps the case of the every single character of the string from upper case to lower case and from lower case to upper case

 

18) split() Function in python

split() Function in python splits the string into smaller chunks, or strings.  Split Function in python usually splits the string with whitespace as a separator.

 

19) splitlines() Function in Python

The splitlines() Function in python splits the string at line breaks and returns a list of lines in the string.

 

20) zfill() Function in Python

zfill() Function in Python pads string on the left with zeros to the required width.

 

21) startswith() Function in Python

startswith() Function in python checks whether the string starts with a specific string. startswith() function returns True if the string starts with the specified string . If not it returns False.

 

22) String Replace in python – replace() Function

replace() Function in python replaces a  string or substring with an alternative string, which can have different size.

 

python basics tutorial

 

Author

  • Sridhar Venkatachalam

    With close to 10 years on Experience in data science and machine learning Have extensively worked on programming languages like R, Python (Pandas), SAS, Pyspark.