Skip to content

Commit a8e57c7

Browse files
committed
fix: various improvements to the Python lesson about saving data
1 parent 153d776 commit a8e57c7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sources/academy/webscraping/scraping_basics_python/08_saving_data.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ import csv
9393
import json
9494
```
9595

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:
9797

9898
```py
9999
with open("products.json", "w") as file:
@@ -167,9 +167,9 @@ Alice,24,"kickbox, Python"
167167
Bob,42,"reading, TypeScript"
168168
```
169169

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.
171171

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.
173173

174174
![CSV example preview](images/csv-example.png)
175175

@@ -183,7 +183,7 @@ from decimal import Decimal
183183
import csv
184184
```
185185

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:
187187

188188
```py
189189
with open("products.csv", "w") as file:
@@ -193,7 +193,7 @@ with open("products.csv", "w") as file:
193193
writer.writerow(row)
194194
```
195195

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:
197197

198198
![CSV preview](images/csv.png)
199199

@@ -203,7 +203,7 @@ We've built a Python application that downloads a product listing, parses the da
203203

204204
## Exercises
205205

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.
207207

208208
### Process your JSON
209209

0 commit comments

Comments
 (0)