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 1ECjx5-0005XA-04 for garchives@archives.gentoo.org; Tue, 06 Sep 2005 20:21:55 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j86KH9bX001628; Tue, 6 Sep 2005 20:17:09 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [134.68.220.30]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j86KH8hO008867 for ; Tue, 6 Sep 2005 20:17:08 GMT Received: from postman1.arcor-online.net ([151.189.20.156] helo=postman.arcor.de) by smtp.gentoo.org with esmtp (Exim 4.43) id 1ECjvh-00075r-Oo for gentoo-user-de@lists.gentoo.org; Tue, 06 Sep 2005 20:20:30 +0000 Received: from jankoh.dyndns.org ([82.100.250.99]) (authenticated bits=0) by postman.arcor.de (8.13.4/8.13.4) with ESMTP id j86KKTiK015952 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=FAIL) for ; Tue, 6 Sep 2005 22:20:29 +0200 (MEST) Received: from localhost (localhost [127.0.0.1]) by jankoh.dyndns.org (Postfix) with ESMTP id 8B5CC4635E for ; Tue, 6 Sep 2005 22:20:28 +0200 (CEST) Received: from jankoh.dyndns.org ([127.0.0.1]) by localhost (jankoh.dyndns.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 28962-09 for ; Tue, 6 Sep 2005 22:20:26 +0200 (CEST) Received: from kohni (kohni.local [192.168.0.3]) by jankoh.dyndns.org (Postfix) with SMTP id 86CEB4630C for ; Tue, 6 Sep 2005 22:20:26 +0200 (CEST) Received: by kohni (sSMTP sendmail emulation); Tue, 6 Sep 2005 22:20:26 +0200 From: Jan Kohnert To: gentoo-user-de@lists.gentoo.org Subject: [gentoo-user-de] Mein erstes Mal in Python ;) Date: Tue, 6 Sep 2005 22:20:21 +0200 User-Agent: KMail/1.8.1 X-Face: vPS[K_.W/4%JFa4`8$=ww[nu"cIb"NJ|;fVB8}BL,Wd|o[|p}mOPcVELPV1g{?/g5^i$)=?utf-8?q?A=0A=09P1Ah7=5DUI=5F8J=5FGjejd=7BC=5CMhOW4F?=(i%guyrNr6C?Vza&Pm\nC~c5+Gb[bU}J}C#>=?utf-8?q?i+S=5C=3Ap-x=0A=09=24i3fVNk=3F?=>9kez`[V5/xFia[clBl5M4IwE+!WJ5Ksbad4nd3'<[!8HW-)|9eX97u*#q#a)=?utf-8?q?V=0A=0918g=7C*HT=5F=7Ex=3AVzP0g=3A3WWrJe7v=5FL58c=25qhCW*=60D?= =?utf-8?q?=23=5DJ?=<#dt6t\2R[T%L=BTN^ld< =?utf-8?q?u=60h3=5D=3Ald=0A=096J?=,L 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: multipart/signed; boundary="nextPart1258187.Ds7FR576dM"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200509062220.26064.nospam001-lists@jankoh.dyndns.org> X-Virus-Scanned: amavisd-new at jankoh.dyndns.org X-Archives-Salt: 8f923b49-c419-466c-bfbe-9b115a73bdd6 X-Archives-Hash: b2dac015274ce4000df8513ae0d4aab8 --nextPart1258187.Ds7FR576dM Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hallo Leute, ich habe mir nun, nachdem mir bei der Einarbeitung in Python die Website ni= cht=20 sehr hilfreich erschien, ein kleines Buch mit einer Python-Einf=C3=BChrung= =20 gekauft. Es lie=C3=9Ft sich so recht gut; aber soooo einfach, wie viele Leu= te=20 Python beschreiben, finde ich es noch nicht... ;) Da ich bisher schon in C,php und bash programmiert habe, sind mir die=20 grundlegenden Sachen zwar schon nach ein paar Stunden weitgehend klar, aber= =20 ich komme jetzt schon zu einem Problem, da=C3=9F ich nicht wirklich l=C3=B6= sen kann: Ich schreibe ein kleines Testprogramm mit derzeit folgendem Inhalt: #!/usr/bin/env python import sys 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() Das gibt mir auch aus, was es soll, nur bin ich gezwungen, einen Parameter= =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, da=C3= =9F er in dem=20 =46All ebenfalls "Fehler" hinschreibt und das Programm normal endet. Der Co= de=20 w=C3=BCrde in C so funktionieren, aber in Python ist das wohl etwas anderes= =2E.. :-( Ich kenne jedenfalls von C den Wert argc, der mir die Anzahl der Argumente= =20 gibt, leider konnte ich bis jetzt nichts vergleichbares finden. Das einzige= ,=20 was mich entfernt an sowas erinnert, ist getopt - das habe ich noch nicht=20 ganz verstanden, naja das kommt noch - es erscheint mir aber etwas=20 Overhead... Das mu=C3=9F doch einfacher gehen, nur wie? Danke! MfG Jan P.S.: Kennt jemand eine gute Onlinedoku =C3=BCber Python? So =C3=A4hnlich w= ie die von=20 php, die ich einfach nur klasse finde... =2D-=20 OpenPGP Public-Key Fingerprint: 0E9B 4052 C661 5018 93C3 4E46 651A 7A28 4028 FF7A --nextPart1258187.Ds7FR576dM Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.9.18 (GNU/Linux) iD8DBQBDHfoKZRp6KEAo/3oRAub2AKC7qJXaPjjPqbaZqrtOOuhunCF65ACgpv8z vnpF2dg1nkFIpxCFdnPUCGU= =WE0p -----END PGP SIGNATURE----- --nextPart1258187.Ds7FR576dM-- -- gentoo-user-de@gentoo.org mailing list