如何解决python中的“未解决的引用'日期'”

时间:2018-11-01 09:47:05

标签: python pandas function

具有:

def con_cur():        
    try:
        sqlconn = pymysql.connect(host='HOST', port=port, user='root_name',
                                  passwd='password', db='db_name', autocommit=True)
        cur = sqlconn.cursor()    
        today = datetime.today()
        last_days = []
        cur.execute("select MAX(DateOfAddition) from CurrencyHistory")
        max_date = cur.fetchall()
        maxdate = max_date[0][0]
        dates = pd.date_range(maxdate, today)
    except Exception as e:
        raise e

def web_link(cur):              
    con_cur()
    for last_days in dates:
        try:
            date = str(last_days.date())
            url = 'https://www.A-Z.com/histo/?from=inr&amount=0&data=%s' % date

         except Exception as e:
                  raise e

在此代码中,错误是:

Unresolved reference 'dates' less... (Ctrl+F1) 
Inspection info: This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.

所以我如何克服这个问题(可能是从一个函数调用另一个变量)

0 个答案:

没有答案