Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update crypto_data_extraction.py #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crypto_tutorial/crypto_data_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
cryptoDict = dict(data1)

#write to CSV
with open('coin_names.csv', mode = 'w') as test_file:
with open('coin_names.csv', mode = 'w', newline='') as test_file:
test_file_writer = csv.writer(test_file, delimiter = ',', quotechar = '"', quoting=csv.QUOTE_MINIMAL)
for coin in cryptoDict.values():
name = coin['Name']
Expand All @@ -79,7 +79,7 @@
res_json = json.loads(res.decode('utf-8'))
data = res_json['Data']
# write required fields into csv
with open('crypto_prices.csv', mode = 'a') as test_file:
with open('crypto_prices.csv', mode = 'a', newline='') as test_file:
test_file_writer = csv.writer(test_file, delimiter = ',', quotechar = '"', quoting=csv.QUOTE_MINIMAL)
for day in data:
rawts = day['time']
Expand Down Expand Up @@ -116,7 +116,7 @@
res_json = json.loads(res.decode('utf-8'))
data = res_json['Data']
# write required fields into csv
with open('btc_prices.csv', mode = 'a') as test_file:
with open('btc_prices.csv', mode = 'a', newline='') as test_file:
test_file_writer = csv.writer(test_file, delimiter = ',', quotechar = '"', quoting=csv.QUOTE_MINIMAL)
for day in data:
rawts = day['time']
Expand Down Expand Up @@ -147,7 +147,7 @@
res_json = json.loads(res.decode('utf-8'))
data = res_json['Data']
# write required fields into csv
with open('eth_prices.csv', mode = 'a') as test_file:
with open('eth_prices.csv', mode = 'a', newline='') as test_file:
test_file_writer = csv.writer(test_file, delimiter = ',', quotechar = '"', quoting=csv.QUOTE_MINIMAL)
for day in data:
rawts = day['time']
Expand Down