Python strings zusammenführen
-
hallo, da mir in den "vergesst c++" niemand geantwortet hat, hier nochmal
wie "caste" ich in python? ich dachte das macht Python automatisch
z.b.
Code:
string = "a" + "b" + "c"
print string
zahl = 123
string2 = "abc" + zahl + "def"=========console============
abc
abc123
def==========================
Code:
string = "a" + "b" + "c"
print string
zahl = 123
string2 = "abc" + zahl + "def"=========console============
abc
abc123
def==========================
Code:
string = "a" + "b" + "c"
print string
zahl = 123
string2 = "abc" + zahl + "def"=========console============
abc
abc123
def==========================
warum steht das def nicht direkt hinter "123" sondern erst eine zeile weiter unten?
-
Eigentlich sollte das einen Fehler geben.
print "abc"+str(123)+"def" print "abc%ddef" % 123