1 #!/usr/bin/python 2 #-*- coding:utf-8 3 import pymongo 4 connection=pymongo.MongoClient() 5 tdb=connection.jikexueyuan 6 post_info=tdb.test 7 info={"name":"xiaoli","age":13,"sex":"gg"} 8 info2={"name":"ahuang","age":15,"sex":"mm"} 9 post_info.insert(info) 10 post_info.insert(info2) 11 for i in post_info.find(): 12 print i