为什么会出现此错误?预期缩进的块(<unknown>,第106行)pylint(语法错误)

时间:2019-02-15 23:24:06

标签: python python-2.7

我正在尝试运行此python文件,当我尝试在终端中运行此文件或直接执行(双击文件)时,我是python的新编程人员 我收到此错误:

File "C:\Users\benja\code\orig-master\data_new_score.py", line 106
l.append(info_cc_d  w(loan_id).values())
^

我的文件

import pandas as pd
import yaml
import MySQLdb
import datetime

loan_ids = ['10003395','10008588','10008591','10008611','10008638','10008653','10008665','10008674','10008675','10013191','10003674','10003689','10003692','10003711','10003716','10003722','10003728','10003733','10003739','10003776','10003785','10003820','10003822','10003827','10003309','10003316','10003327','10003348','10005950']

columns = info_cc_dw('10003391').keys()
l=[info_cc_dw('10003391').values()]

for loan_id in loan_ids:
l.append(info_cc_d  w(loan_id).values())

data = pd.DataFrame(l,columns=columns)
data.to_csv('test_dw.csv')

1 个答案:

答案 0 :(得分:0)

尝试一下:

import pandas as pd
import yaml
import MySQLdb
import datetime

loan_ids = ['10003395','10008588','10008591','10008611','10008638','10008653','10008665','10008674','10008675','10013191','10003674','10003689','10003692','10003711','10003716','10003722','10003728','10003733','10003739','10003776','10003785','10003820','10003822','10003827','10003309','10003316','10003327','10003348','10005950']

columns = info_cc_dw('10003391').keys()
l=[info_cc_dw('10003391').values()]

for loan_id in loan_ids:
  l.append(info_cc_d  w(loan_id).values())

data = pd.DataFrame(l,columns=columns)
data.to_csv('test_dw.csv')

如您所见,我在您的 for循环之后缩进了一行。这只是python语法的一部分。