Home Article Practice python 6.23

python 6.23

2024-06-23 22:35  views:288  source:小键人13497405    

# 从 csv 文件中读取数据
import csv
f = open('data.csv', 'r')
data = list(csv.reader(f))
# print(data)
f.close()
# 找出价格大于等于 2 且价格最低的文具
min = 100
for i in data:
name = i[0]
price = float(i[1])
print(name,price)
if price >= 2:
print(price)
if min > price:
min = price
min_name = name
print(min_name, min)



Disclaimer: The above articles are added by users themselves and are only for typing and communication purposes. They do not represent the views of this website, and this website does not assume any legal responsibility. This statement is hereby made! If there is any infringement of your rights, please contact us promptly to delete it.

字符:    改为:
去打字就可以设置个性皮肤啦!(O ^ ~ ^ O)