##No need to import arcpy if you are running functions in the same Python window. import arcpy
arcpy.ListUsers("c:\\temp\pgdb.sde")
返回用户连接的列表。
[user(ClientName=u'PC4', ConnectionTime=datetime.datetime(2018, 10, 18, 8, 30, 19),
ID=18, IsDirecConnection=True, Name=u'publisher1')]
[user(ClientName=u'PC25', ConnectionTime=datetime.datetime(2018, 10, 21, 14, 10, 43),
ID=33, IsDirecConnection=True, Name=u'editor2')]
[user(ClientName=u'PC11', ConnectionTime=datetime.datetime(2018, 10, 22, 9, 18, 26),
ID=39, IsDirecConnection=True, Name=u'reader5')]
[user(ClientName=u'PCA2', ConnectionTime=datetime.datetime(2018, 10, 22, 11, 21, 2),
ID=41, IsDirecConnection=True, Name=u'sde')]