python: cannot concatenate 'str' und 'Tupel' Objekte (sollte es funktioniert!)

Ich habe einen code:

print "bug " + data[str.find(data,'%')+2:-1]
temp = data[str.find(data,'%')+2:-1]
time.sleep(1)
print "bug tuple " + tuple(temp.split(', '))

Und nach dieser mein Antrag zeigt:

Fehler 1, 2, 3
Traceback (most recent
call last): File
"C:\Python26\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 312, in RunScript
exec codeObject in main.dict Datei "C:\Documents und
Einstellungen\k.pawlowski\Desktop\atsserver.py",
line 165, in
print "Fehler-Tupel" + tuple(temp.split(', ')) TypeError:
cannot concatenate 'str' und 'tuple'
Objekte

Ich weiß nicht, was ich falsch gemacht. print-Tupel('1, 2, 3'.split(', ')) funktioniert.

  • Wenn Sie Zweifel haben, testen Sie im interaktiven interpreter!! >>> ftw!!!
InformationsquelleAutor CarolusPl | 2010-08-31
Schreibe einen Kommentar