You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sources/academy/webscraping/scraping_basics_python/08_saving_data.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,7 +93,7 @@ import csv
93
93
import json
94
94
```
95
95
96
-
Next, instead of printing the data, we'll finish the program by exporting it to JSON. Replace`print(data)` with the following:
96
+
Next, instead of printing the data, we'll finish the program by exporting it to JSON. Let's replace the line`print(data)` with the following:
97
97
98
98
```py
99
99
withopen("products.json", "w") asfile:
@@ -167,9 +167,9 @@ Alice,24,"kickbox, Python"
167
167
Bob,42,"reading, TypeScript"
168
168
```
169
169
170
-
In the CSV format, if values contain commas, we should enclose them in quotes. You can see that the writer automatically handled this.
170
+
In the CSV format, if a value contains commas, we should enclose it in quotes. When we open the file in a text editor of our choice, we can see that the writer automatically handled this.
171
171
172
-
When browsing the directory on macOS, we can see a nice preview of the file's contents, which proves that the file is correct and that other programs can read it as well. If you're using a different operating system, try opening the file with any spreadsheet program you have.
172
+
When browsing the directory on macOS, we can see a nice preview of the file's contents, which proves that the file is correct and that other programs can read it. If you're using a different operating system, try opening the file with any spreadsheet program you have.
173
173
174
174

175
175
@@ -183,7 +183,7 @@ from decimal import Decimal
183
183
import csv
184
184
```
185
185
186
-
Next, let’s append one more export to end of the source code of our scraper:
186
+
Next, let's add one more data export to end of the source code of our scraper:
187
187
188
188
```py
189
189
withopen("products.csv", "w") asfile:
@@ -193,7 +193,7 @@ with open("products.csv", "w") as file:
193
193
writer.writerow(row)
194
194
```
195
195
196
-
Now the program should work as expected, producing a CSV file with the following content:
196
+
The program should now also produce a CSV file with the following content:
197
197
198
198

199
199
@@ -203,7 +203,7 @@ We've built a Python application that downloads a product listing, parses the da
203
203
204
204
## Exercises
205
205
206
-
In this lesson, you learned how to create export files in two formats. The following challenges are designed to help you empathize with the people who'd be working with them.
206
+
In this lesson, we created export files in two formats. The following challenges are designed to help you empathize with the people who'd be working with them.
0 commit comments