[Tutor] Dodgey if loop ?

Nick Lunt nick at javacat.f2s.com
Mon Sep 6 18:37:51 CEST 2004



>-----Original Message-----
>From: Lloyd Kvam [mailto:pythonTutor at venix.com]
>Sent: 06 September 2004 15:49

>You might be better off parsing the services file once into a dictionary
>(or other map-like container), and then using pnumber to retrieve the
>label for the port.

Thankyou, I agree with the dictionary way, and have now implemented that.

>From: Kent Johnson [mailto:kent_johnson at skillsoft.com]
>Sent: 06 September 2004 15:54

>The problem is that you are returning too soon. The first time you find p
>!= pnumber you will return ?. For example if /etc/services contains entries
>for ports 7 and 25, when you see the 7 you will return ?.

Ahh, it's so clear when someone takes the time to explain it to you. Thanks.

Many thanks to both of you for helping me out.

Nick.





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.752 / Virus Database: 503 - Release Date: 03/09/2004



More information about the Tutor mailing list