Answers for "how to pop element from string in python"

8

delete certain characters from a string python

for char in line:
    if char in " ?.!/;:":
        line.replace(char,'')
Posted by: Guest on April-08-2020
-1

pop a string from a list python

my_list = [12, 'Siya', 'Tiya', 14, 'Riya', 12, 'Riya']
my_list.remove(12) # it will remove the element 12 at the start.
print(my_list)
my_list.remove('Riya') # will remove the first Riya from the list
print(my_list)
my_list.remove(100)  #will throw an error
print(my_list)
Posted by: Guest on May-26-2021

Code answers related to "how to pop element from string in python"

Python Answers by Framework

Browse Popular Code Answers by Language