Hallo,
habe dazu nix gefunden:
Gibts in Python auch verkürzte Schreibweise für Variablenzuweisungen wie in PHP?
Ich meine zB
variable+="test"
bedeutet in PHP:
variable=variable."test"
Danke
Stolzi
Variablenzuweisung?
-
- User
- Beiträge: 728
- Registriert: Sonntag 22. September 2002, 08:32
- Wohnort: Sauerland
- Kontaktdaten:
Warum probierst du das nicht einfach aus oder schlägst im Handbuch ( www.python.org ) nach?
Hans
Code: Alles auswählen
[hans@rosi hans]$ python
Python 2.3.3 (#1, May 7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a=3
>>> a+=4
>>> print a
7
>>> s+="test"
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name 's' is not defined
>>> s = "Hallo"
>>> s+="test"
>>> print s
Hallotest
>>>