Remove empty spaces from a list of strings.

In this program, we will take a list of strings as input and remove empty spaces from a list of strings.

Steps to solve the program
  1. Take a list of strings as input.
  2. Create an empty list.
  3. Add every string from the input list to the empty list except empty spaces.
  4. Print the output.
				
					#Input lists
List1 =  ["Python", " ", " ","sqatools"]
List2 = []

for string in List1:
    if string != " ":
        List2.append(string)

#Printing output
print(List2)
				
			

Output :

				
					['Python', 'sqatools']
				
			

replace different characters in the string at once.

remove punctuations from a string

Leave a Comment