## 第一种 mongodb = pymongo.MongoClient(f'mongodb://{username}:{password}@localhost:27017/{databasename}', serverSelectionTimeoutMS=3000) ## 第二种 client_one = pymongo.MongoClient(ip,int(port),username=username,password=password,serverSelectionTimeoutMS=3000)