+ 11
How do I write a code for example from "foo" to exclude just the letter "o"?
2 Antworten
+ 4
xy = {1, 2, 1, 3, 1, 4, 5, 6,"foo"}
print(xy)
xy.add(-7)
xy.remove(3)
for item in xy:
if isinstance(item, str):
if "o" in item:
newitem = item.replace("o", "")
xy.remove(item)
xy.add(newitem)
print(xy)
+ 1
a = "foo"
print(a.replace("o", ""))