Remove function error | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 2

Remove function error

So I used the count function to extract an object from a list, because I was trying to write a program to remove @ symbols from a phrase, and then I tried to use the remove function on the object and it says the error, ’str has no object to attribute’ or something like that. https://code.sololearn.com/cCKzvSud6l9J/?ref=app

20th May 2018, 3:02 AM
...
... - avatar
4 ответов
20th May 2018, 8:54 AM
Maninder $ingh
Maninder $ingh - avatar
+ 1
hey jack, here you go, word=input(' ') print ("Word = ",word) while word.count('@') != 0: word = word.replace('@','') print (word) input is always in string, so no need of str explicitly. Also if you want to process on string than no need of creating list.
20th May 2018, 3:55 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
+ 1
I think no need to use while loop too, because replace method can replace multiple occurrences. word=input(' ') word = word.replace('@','') print (word)
20th May 2018, 8:08 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
+ 1
Ok I get it thanks everyone!!
20th May 2018, 12:10 PM
...
... - avatar