How to replace items in Python Programming

preview_player
Показать описание
Hey, hope you find this video helpful in replacing strings or int or anything else in your code to something else using the .replace function
Рекомендации по теме
Комментарии
Автор

I get this error: AttributeError: 'list' object has no attribute 'replace'

TigerM
Автор

Nice. I was looking for a way to transform the tags of an XML-File and I'll give this a try.

RagHelen
Автор

Why won't this work here:
vowels = ['a', 'e', 'i', 'o', 'u']
bullChar = ['*', '*', '*', '*', '*']
sentence = 'After 1500 years of that thinking surpresed, '
print(sentence)
sentence.lower()
x=list(sentence)
def vowel_replace(vowels, bullChar, x):
for i in range(len(bullChar)):
x=x.replace(vowels[i], bullChar[i])
return x

x = ''.join(x)
x

dylanmaulucci
welcome to shbcf.ru