+ 2

Operand

Hi, Suppose x='123' x+='gfr' print (x) will result 123gfr Question: Can I substract 'gfr' as well?

6th Dec 2016, 5:47 AM
Grigor
1 Answer
+ 3
Subtracting strings by '-' operator is not defined, but you can call replace method on a string. Examples: "foo bar baz".replace("bar ", "") "123gfr".replace("gfr", "")
6th Dec 2016, 6:56 AM
Dominik MagdaleƄski
Dominik MagdaleƄski - avatar