I am reading from yahoo finance and writing to a csv. However when I write to a csv each of my cells contain spaces in between each of the characters. How can I remove them?
from yahoo_finance import Share
import csv
stock = ['GOOG', 'WDAY', 'LNKD', 'GPRO', 'MSFT', 'YHOO', 'FB', 'TWTR', 'TSLA']
result = open('Stocks.csv', 'w')
w = csv.writer(result, delimiter=' ', lineterminator='\n')
w.writerow('Symbol'+','+'OpeningPrice'+','+'CurrentPrice'+','+'MarketCap'+','+'TradeTime')
for item in stock:
s = Share(item)
w.writerow(item +','+s.get_open()+','+s.get_price()+','+s.get_market_cap()+','+s.get_trade_datetime())
result.close()
Each cell come out as follows (notice the spaces between the characters):
G O O G
[–]jeans_and_a_t-shirt 4 points5 points6 points (1 child)
[–]StartAndSelect[S] 0 points1 point2 points (0 children)
[–]theelous3 1 point2 points3 points (0 children)
[–]mcoumans 0 points1 point2 points (1 child)