in the following statement, QBDownloaderDayPrice inherits from QBDownloader, execution Times error AttributeError: "QBDownloaderDayPrice" object has no attribute" _ QBDownloader__flag_encoding". Could you tell me how to solve it?
import time
import datetime
import tushare as ts
import pandas as pd
class QBDownloader (object):
def __init__(self):
self.__filename = ""
self.__df_data = null
self.__flag_encoding = 1
def saveto_csv(self):
if self.__flag_encoding == 1:
self.__df_data.to_csv(self.__filename, encoding="GBK")
else:
self.__df_data.to_csv(self.__filename)
class QBDownloaderDayPrice (QBDownloader):
def __init__(self):
self.__filename = "QBdata\\DayPrice\\dp" + time.strftime("%Y%m%d", time.localtime()) + ".csv"
self.__df_data = self.get_df_data()
self.__flag_encoding = 1
def get_df_data(self):
-sharpdataframe
df_day_price = ts.get_today_all()
return df_day_price
if name ="_ _ main__":
obj_dl = QBDownloaderDayPrice()
obj_dl.saveto_csv()
print u""