我想读取一个 csv 文件,直到它找到一个空/新行我使用 END 作为分隔符,想将其更改为新/空行
def getActualData(ws_name, ws_value):
outputDatafile = open('D:\\Files\\Actual_Data.csv', 'r',newline="\n")
outputReader = csv.reader(outputDatafile, delimiter=',', quoting=csv.QUOTE_NONE)
outputData = {}
check =0
for rows in outputReader:
#print "Row first:", rows[0]," Row second:",rows[1]
if(check==0):
if(rows[0]==ws_name and rows[1]==ws_value):
check+=1
elif (rows[0]=='\n' and rows[1]=='\n'):
break
else:
outputData.update({rows[0]:rows[1]})