Checking socket type?

Jerome Chan eviltofu at rocketmail.com
Sat Jun 10 10:05:00 EDT 2000


In article <Pine.GSO.4.10.10006101618110.5325-100000 at sundial>, Moshe 
Zadka <moshez at math.huji.ac.il> wrote:

> On Sat, 10 Jun 2000, Jerome Chan wrote:
> 
> > How would I check to see if an object is an instance of a socket?
> 
> Use the type() function:
> 
> >>> type(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
> <type 'socket'>
> 
> --
> Moshe Zadka <moshez at math.huji.ac.il>
> http://www.oreilly.com/news/prescod_0300.html
> http://www.linux.org.il -- we put the penguin in .com
> 
> 

Oh I found it in the socket documentation.

if type(s)==socket.SocketType: print "hello"



More information about the Python-list mailing list