FAQs
View entire FAQ in full Up to table of contentsFrequently Asked Questions
Python
Get IP using Python
How to get IP address of my computer?
import socket
socket.gethostbyname(socket.gethostname())
socket.gethostbyname_ex(socket.gethostname())
How to lock a file
How can I lock a file, so that other user can't modify it?
Use mmap
see documant at
http://docs.python.org/lib/module-mmap.html
password
How do I check unix password?
import pwd, crypt
def login(user, password):
"Check if user would be able to login using password"
try:
pw1 = pwd.getpwnam(user)[1]
pw2 = crypt.crypt(password, pw1[:2])
return pw1 == pw2
except KeyError:
return 0 # no such user
user = raw_input("username:")
password = raw_input("password:")
if login(user, password):
print "welcome", user
else:
print "login failed"
webbrowser.open Firefox 3 Issue
Problem with Pmv help link button?
On Linux with the latest Firefox 3 when you click to open help link
there is a following issue:
This FAQ applies to: 1.5.4
