import posix import string uid = `posix.getuid()` passwd = open('/etc/passwd') for line in passwd.readlines(): rec = string.splitfields(line, ':') if rec == uid: print 'hello', rec, print 'mind if we call you bruce?' break else: print "I can't find you in /etc/passwd" :)
All 2 RepliesReply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.