https://github.com/python-ldap/python-ldap
Quick usage example:
import ldap l = ldap.initialize("ldap://my_ldap_server.my_domain") l.simple_bind_s("","") l.search_s("o=My Organisation, c=AU", ldap.SCOPE_SUBTREE, "objectclass=*")
参考脚本:https://www.ibm.com/developerworks/cn/aix/library/au-ldap_crud/index.html
注意将ldap.open改成ldap.initialize(),否则会报module 'ldap' has no attribute 'open'