Skip to content

Commit

Permalink
killed wb, added suffix header, fixed a missing [:-1]
Browse files Browse the repository at this point in the history
  • Loading branch information
schwanksta committed Jul 17, 2023
1 parent 097f08c commit 36b53e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ my_list[-1]
"d"
```

So if you want ever item in a list besides the last, you would do:
So if you want every item in a list besides the last, you would do:

```python
my_list[-1]
Expand Down
12 changes: 6 additions & 6 deletions docs/web-scraping.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ for row in table.findAll('tr'):
list_of_cells.append(text)
list_of_rows.append(list_of_cells)
outfile = open("./inmates.csv", "wb")
outfile = open("inmates.csv", "w")
writer = csv.writer(outfile)
writer.writerows(list_of_rows)
```
Expand Down Expand Up @@ -371,7 +371,7 @@ for row in table.findAll('tr'):
list_of_cells.append(text)
list_of_rows.append(list_of_cells)
outfile = open("./inmates.csv", "wb")
outfile = open("inmates.csv", "")
writer = csv.writer(outfile)
writer.writerow(["Last", "First", "Middle", "Gender", "Race", "Age", "City", "State"])
writer.writerows(list_of_rows)
Expand Down Expand Up @@ -438,13 +438,13 @@ table = soup.find('tbody', attrs={'class': 'stripe'})
list_of_rows = []
for row in table.findAll('tr'):
list_of_cells = []
for cell in row.findAll('td'):
text = cell.text.replace(' ', '')
for cell in row.findAll('td')[:-1]:
text = cell.text
list_of_cells.append(text)
list_of_rows.append(list_of_cells)
outfile = open("./inmates.csv", "wb")
outfile = open("inmates.csv", "w")
writer = csv.writer(outfile)
writer.writerow(["Last", "First", "Middle", "Gender", "Race", "Age", "City", "State"])
writer.writerow(["Last", "First", "Middle", "Suffix", "Gender", "Race", "Age", "City", "State"])
writer.writerows(list_of_rows)
```

0 comments on commit 36b53e6

Please sign in to comment.