I like that in PHP I can do the following
$myInteger++;
$myString += 'more text';
With Python I must do the following
myInteger = myInteger + 1
myString = myString + "more text"
Is there a better way to add or append to a variable in Python?
Python doesn't have the increment (++) and decrement (--) operators, but it does have the += operator (and -=, etc.) so you can do this:
myInteger += 1
myString += "more text"
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