which version of python are you using?
In python 3
I would split line 149, and use the format statement:
(not tested- may need minor tweeking)
In python 3
I would split line 149, and use the format statement:
with open("ratios.csv", "a") as ratiofile: buff = '{},{},{},{},{},{},{},{},{},{},{},{},{}\n'.format(tradingSymbol, entityRegistrantName, entityCentralIndexKey, currentFiscalYearEndDate, docType, documentPeriodEndDate, documentFiscalYearFocus, documentFiscalPeriodFocus, entityCommonStockSharesOutstanding, documentCreationDate, commonStockSharesIssued, treasuryStockShares, commonStockSharesOutstanding) ratiofile.write(buff)if python 3.6 (and newer)
with open("ratios.csv", "a") as ratiofile: with open("ratios.csv", "a") as ratiofile: buff = f'{tradingSymbol},{entityRegistrantName},{entityCentralIndexKey},{currentFiscalYearEndDate},' \ f'{docType},{documentPeriodEndDate},{documentFiscalYearFocus},{documentFiscalPeriodFocus},' \ f'{entityCommonStockSharesOutstanding},{documentCreationDate},{commonStockSharesIssued},' \ f'{treasuryStockShares},{commonStockSharesOutstanding}\n' ratiofile.write(buff)You don't need the close statement when using with, file is closed automatically.
(not tested- may need minor tweeking)