Hallo ich habe vor zwei Tagen mit Python angefangen und bei dem nachfolgenden Programm einen Syntaxfehler, den ich nicht entdecke. #!/usr/bin/ python2.3 import re #Pfad zum CGIHTTP-Server Modul file="/usr/local/lib/python2.3/CGIHTTPServer.py" replaced=0 data=open(file).readlines() f=open(file, "w+") for a in data: f.write(a) if a.find("have_fork")!=-1 and not replaced: f.write(re.search("\s+" ,a)\ group()+"have_fork=None\n" ) /*hier gibt der debugger syntaxfehler aus*/ replaced=1 Daher meine Frage wo liegt der Fehler? Danke für euere Hilfe Uli _______________________________________________ python-de maillist - python-de@python.net http://python.net/mailman/listinfo/python-de
--On 17. Juni 2005 07:43:25 +0000 Uli Kleemann <hackbox@lug-saar.de> wrote:
# !/usr/bin/ python2.3
import re
# Pfad zum CGIHTTP-Server Modul file="/usr/local/lib/python2.3/CGIHTTPServer.py" replaced=0 data=open(file).readlines() f=open(file, "w+") for a in data: f.write(a) if a.find("have_fork")!=-1 and not replaced: f.write(re.search("\s+" ,a)\ group()+"have_fork=None\n" ) /*hier gibt der debugger syntaxfehler aus*/ replaced=1
Daher meine Frage wo liegt der Fehler?
ich glaube, das Problem kannst Du selber finden, wenn Du Dir die Ausgabe des Tracebacks genau anschaust. Zum ersten fehlt vor group ein '.' (wie Python auch korrekt anzeigt). Und zum zweiten gibt es in Python keine /* */ Kommentare. -aj _______________________________________________ python-de maillist - python-de@python.net http://python.net/mailman/listinfo/python-de
participants (2)
-
Andreas Jung
-
Uli Kleemann