In this section, we discuss several ways to save our data, such as saving data or estimating results to a text file, a binary file, and so on.
The following code will download IBM's daily price historical data and save it to a text file:
>>>from matplotlib.finance import quotes_historical_yahoo >>>import re >>>ticker='dell' >>>outfile=open("c:/temp/dell.txt","w") >>>begdate=(2013,1,1) >>>enddate=(2013,11,9) >>>p = quotes_historical_yahoo(ticker, begdate, enddate,asobject=True, adjusted=True) >>>x2= re.sub('[\(\)\{\}\.<>a-zA-Z]','', x) >>>outfile.write(x2) >>>outfile.close()