MongoDB基本操作之Python篇
连接数据库 MongoClient VS Connection5.2查询特定键(£ ields)
select name, age from users where age=21
for u in db. users find((age: 21], ["name",age!): print u
for u in db. users find(fields =L"name",age ): printl
5.3排序(SORT)
pymmongo. ASCEND
程序代码如下
import os
import re
os.system(nmap -sP 192.168.3.0/24) //扫描IP
mac = os.popen(cat /proc/net/arp ).readlines() //按行读取
length = len(mac)
for i in range(1,length):
b= re.split(r +,mac[i]) //按照多个空格分割
if(b[2]=='0x2'):
print b[3]
原始