- 1

How to remove something from list,for ex. I want to remove '?' from a=who are you ?

21st Jun 2021, 3:33 PM
Vaibhav Tiwari
4 Réponses
+ 3
In Python, strings are immutable, so you need to create a new string. You have several options for how to create a new line. If you want to remove 'M' wherever it appears: a = "Who are you?" b = a.replace ("?", "") ---------------------------------------------------------------------------------------- if you want to learn python I recommend you: Books: "Byte of Python", "Learning Python: Game Programming, Data Visualization, Web Applications. Mathes Eric", "Learn Python Mark Lutz". Free course: SoloLearn, W3school: https://www.w3schools.com/
21st Jun 2021, 3:38 PM
SammE
SammE - avatar
+ 5
Simple just use pop or del function 😽
21st Jun 2021, 3:43 PM
SωAti
SωAti - avatar
+ 1
a = "who are you?" print(a[:-1])
21st Jun 2021, 3:39 PM
Shadoff
Shadoff - avatar
0
How?, please 🥺 tell me
21st Jun 2021, 3:43 PM
Vaibhav Tiwari