1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # # µû¶óÇÏ¸ç ¹è¿ì´Â ÆÄÀ̽ã°ú µ¥ÀÌÅÍ°úÇÐ(»ý´ÉÃâÆÇ»ç 2020) # 12.5 CSV¿¡¼ ¿øÇÏ´Â µ¥ÀÌÅ͸¦ »Ì¾Æ º¸ÀÚ, 310ÂÊ # import csv f = open('d:/data/weather.csv') # CSV ÆÄÀÏÀ» ¿¾î¼ f¿¡ ÀúÀåÇÑ´Ù. data = csv.reader(f) # reader() ÇÔ¼ö¸¦ ÀÌ¿ëÇÏ¿© Àд´Ù. header = next(data) max_wind = 0.0 for row in data: # ¹Ýº¹ ·çÇÁ¸¦ »ç¿ëÇÏ¿© µ¥ÀÌÅ͸¦ Àд´Ù. if row[2] == '' : # Æò±Õ dz¼Ó µ¥ÀÌÅÍ°¡ ¾ø´Â °æ¿ì 0À» ó¸® wind = 0 else : wind = float(row[2]) # Æò±Õ dz¼Ó µ¥ÀÌÅ͸¦ ½Ç¼ö·Î º¯È¯ÇØ ÀúÀå if max_wind < wind : # ÃÖ´ë dz¼ÓÀ» °»½ÅÇÏ´ÂÁö °Ë»ç max_wind = wind # ÇöÀç±îÁöÀÇ ÃÖ´ë dz¼Óº¸´Ù Å©¸é »õ·Î ±â·Ï print('Áö³ 10³â°£ ¿ï¸ªµµÀÇ ÃÖ´ëdz¼ÓÁß ÃÖ´ë°ªÀº ', max_wind, 'm/s') | cs |