Format with Black

上级 8dbfe533
from mongoengine import connect, Document, StringField, ListField, URLField
from mongoengine import Document, ListField, StringField, URLField, connect
# Establishing a Connection
connect(db="rpblog", host="localhost", port=27017)
......@@ -17,7 +17,7 @@ post = Posts(
title="Beautiful Soup: Build a Web Scraper With Python",
author="Martin",
contributors=["Aldren", "Geir", "Jaya", "Joanna", "Mike"],
url="https://realpython.com/beautiful-soup-web-scraper-python/"
url="https://realpython.com/beautiful-soup-web-scraper-python/",
)
post.save() # Insert the new post
......
......@@ -25,23 +25,15 @@ print(f"One post: {result.inserted_id}")
post_1 = {
"title": "Python’s Requests Library (Guide)",
"author": "Alex",
"contributors": [
"Aldren",
"Brad",
"Joanna"
],
"url": "https://realpython.com/python-requests/"
"contributors": ["Aldren", "Brad", "Joanna"],
"url": "https://realpython.com/python-requests/",
}
post_2 = {
"title": "Object-Oriented Programming (OOP) in Python 3",
"author": "David",
"contributors": [
"Aldren",
"Joanna",
"Jacob"
],
"url": "https://realpython.com/python3-object-oriented-programming/"
"contributors": ["Aldren", "Joanna", "Jacob"],
"url": "https://realpython.com/python3-object-oriented-programming/",
}
new_result = posts.insert_many([post_1, post_2])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册