MongoClient: 資料庫連接
一、基本使用
1、連接本地資料庫,列印local中的集合(表)
# coding:utf8 import pymongo as p # 鏈接資料庫 client = p.MongoClient("mongodb://localhost:27017") # 進入資料庫local mydb = client["local"] # 查看當前資料庫中的集合,mysql中稱之為表 tablelist = mydb.list_collection_names() # 列印 print(tablelist)
結果如下:

讀書和健身總有一個在路上
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/149348.html
標籤:Python
下一篇:Python學習筆記:斷言
