在我的Spring Boot应用程序的csv
文件夹中,有一个import csv
def mountain_height(filename):
""" Read in a csv file of mountain names and heights.
Parse the lines and print the names and heights.
Return the data as a dictionary.
The key is the mountain and the height is the value.
"""
mountains = dict()
msg = "The height of {} is {} meters."
err_msg = "Error: File doesn't exist or is unreadable."
# TYPE YOUR CODE HERE.
with open('mountains.csv', 'r') as handle:
reader = csv.reader(handle, delimiter=',')
for row in reader:
name = row[0]
height = row[1]
int(height)
dictionary = {name: height}
for k,v in dictionary.items():
print(k,v)
return dictionary
文件。当我在IntelliJ 2019.3中打开文件时,文件的所有内容均为红色,为什么?
答案 0 :(得分:0)
似乎Rainbow CSV
插件将所有csv
文件的内容显示为红色。禁用后,文本再次变黑。