-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ecoron/0.4.2
start adding CsvWriter, add logo
- Loading branch information
Showing
6 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -*- | ||
from serpscrap.config import Config | ||
from serpscrap.serpscrap import SerpScrap | ||
from serpscrap.urlscrape import UrlScrape | ||
from serpscrap.csv_writer import CsvWriter | ||
from serpscrap.markovi import Markovi | ||
from serpscrap.serpscrap import SerpScrap | ||
from serpscrap.tfidf import TfIdf | ||
from serpscrap.urlscrape import UrlScrape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
import csv | ||
import traceback | ||
|
||
|
||
class CsvWriter(): | ||
|
||
def write(self, file_name, my_dict): | ||
try: | ||
with open(file_name, 'w', encoding='utf-8') as f: | ||
w = csv.DictWriter(f, my_dict[0].keys(), dialect='excel') | ||
w.writeheader() | ||
for row in my_dict[1:]: | ||
w.writerow(row) | ||
except Exception: | ||
print(traceback.print_exc()) | ||
raise Exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters