I have a long string, which is basically a list like str="lamp, bag, mirror,"
(and other items)
I was wondering if I can add or subtract some items, in other programming languages I can easily do: str=str-"bag,"
and get str="lamp, mirror,"
this doesnt work in python (I'm using 2.7 on a W8 pc)
Is there a way to split the string across say "bag," and somehow use that as a subtraction? Then I still need to figure out how to add.
you could also just do
print "lamp, bag, mirror".replace("bag,","")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With