From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.43) id 1ECkTJ-0005m1-45 for garchives@archives.gentoo.org; Tue, 06 Sep 2005 20:55:13 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j86KoQuV026369; Tue, 6 Sep 2005 20:50:26 GMT Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j86KoPjO018774 for ; Tue, 6 Sep 2005 20:50:25 GMT Received: (qmail invoked by alias); 06 Sep 2005 20:53:48 -0000 Received: from p54975F4D.dip.t-dialin.net (EHLO stovokor) [84.151.95.77] by mail.gmx.net (mp024) with SMTP; 06 Sep 2005 22:53:48 +0200 X-Authenticated: #8201419 Received: by stovokor (Postfix, from userid 1000) id B3161A71CF0; Tue, 6 Sep 2005 22:53:51 +0200 (CEST) Date: Tue, 6 Sep 2005 22:53:51 +0200 From: Emil Beinroth To: gentoo-user-de@lists.gentoo.org Subject: Re: [gentoo-user-de] Mein erstes Mal in Python ;) Message-ID: <20050906205351.GA29313@stovokor.kiste.lan> Mail-Followup-To: gentoo-user-de@lists.gentoo.org References: <200509062220.26064.nospam001-lists@jankoh.dyndns.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user-de@gentoo.org Reply-to: gentoo-user-de@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <200509062220.26064.nospam001-lists@jankoh.dyndns.org> User-Agent: Mutt/1.5.10i X-Y-GMX-Trusted: 0 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by robin.gentoo.org id j86KoQv4026369 X-Archives-Salt: 2861b74f-28bb-49e6-a244-f1682c4d51a9 X-Archives-Hash: 7a71c50d2e9c4cbcd6adc84764ff496b On Tue, Sep 06, 2005 at 10:20:21PM +0200, Jan Kohnert wrote: > Hallo Leute, Huhu, > #!/usr/bin/env python >=20 > import sys >=20 > if sys.argv[1] =3D=3D "pop": > print "pop" > elif sys.argv[1] =3D=3D "smtp": > print "smtp" > elif sys.argv[1] =3D=3D "http": > print "http" > else: > print "Fehler" > sys.exit() >=20 > Das gibt mir auch aus, was es soll, nur bin ich gezwungen, einen Parame= ter=20 > anzugeben, sonst kommt der sch=C3=B6ne Traceback Fehlerdialog, der mir = erl=C3=A4rt, es=20 > g=C3=A4be kein argv[1]. Das ist ja richtig, nur h=C3=A4tte ich gerne, d= a=C3=9F er in dem=20 > FAll ebenfalls "Fehler" hinschreibt und das Programm normal endet. Der = Code=20 > w=C3=BCrde in C so funktionieren, aber in Python ist das wohl etwas and= eres... :-( Wuerdest du in C nicht einen segfault bekommen? > Ich kenne jedenfalls von C den Wert argc, der mir die Anzahl der Argume= nte=20 > gibt, leider konnte ich bis jetzt nichts vergleichbares finden. len(sys.argv) sollte funktionieren. > P.S.: Kennt jemand eine gute Onlinedoku =C3=BCber Python? So =C3=A4hnli= ch wie die von=20 > php, die ich einfach nur klasse finde... Gut bzw praktisch finde ich: http://docs.python.org/lib/lib.html (python library reference) http://rgruet.free.fr/PQR24/PQR2.4.html (quick ref) http://diveintopython.org/toc/index.html (einfuehrendes online-buch) MfG Emil --=20 So much code, so little time. --=20 gentoo-user-de@gentoo.org mailing list