我有崇高的文字3,但我的简单测试代码(下面)在PowerShell中工作,它不是崇高的。
是否有理由/我该如何解决这个问题? (我已更新路径文件)
import csv
with open('example.csv') as f:
r = csv.reader(f, delimiter=',')
dates = []
colors = []
for row in r:
color = row[3]
date = row[0]
dates.append(date)
colors.append(color)
print (dates)
print (colors)
whatColor = input('What color do you wish to know the date of?')
coldex = colors.index(whatColor)
theDate = dates[coldex]
print('The date of',whatColor,'is the date')
在PowerShell中我得到:
['01/02/2014', '01/03/2014', '01/04/2014']
['red', 'green', 'blue']
What color do you wish to know the date of?green
The date of green is the date
但是在崇高的控制台中我得到了:
['01/02/2014', '01/03/2014', '01/04/2014']
['red', 'green', 'blue']
What color do you wish to know the date of?Traceback (most recent call last):
File "C:\Users\ben\five\pl_pl.py", line 19, in <module>
whatColor = input('What color do you wish to know the date of?')
EOFError: EOF when reading a line
[Finished in 0.3s]