[Tutor] Sloppy Code ?

Alan Gauld alan.gauld at btinternet.com
Thu Nov 16 00:28:52 CET 2006


"Matt Erasmus" <matt.erasmus at gmail.com> wrote

> Yes, that does help, although it doesn't print the FQDN which is 
> what
> I'm really after.
> But thanks to you I now know about the socket module

It is very rarely necessaary to use popen etc to get basic system
information or to perform basic OS commanfs. There are usually
direct function/modules that do the same job more efficiently.
popen is good for running actual applications but if you find
yourself using it for lower level tasks consider a google search
for python <term>.

In this case 'python hostname' gets me the socket module
docs as the first hit...

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list