123213124
作者:互联网
- import math
- import os
- from os import path
- import numpy as np
- filePath = input("Please enter the file path: ");
- while not path.exists(filePath):
- filePath = input("File path error, please re-enter: ");
- if path.exists(filePath):
- break
- file_object = open(filePath,“r”).readlines()
- rainfall=[]
- for line in file_object()[5:]:
- for i in range:
- if file_object(i)>0.1:
- rainfall.append(file_object(i))
- b=np.sum(rainfall)
- print (b)
import math
import os
from os import path
import numpy as np
filePath = input("Please enter the file path: ");
while not path.exists(filePath):
filePath = input("File path error, please re-enter: ");
if path.exists(filePath):
break
file_object = open(filePath,“r”).readlines()
rainfall=[]
for line in file_object()[5:]:
for i in range:
if file_object(i)>0.1:
rainfall.append(file_object(i))
b=np.sum(rainfall)
print (b)
标签:rainfall,filePath,object,file,import,path,123213124 来源: https://blog.csdn.net/Wanna_up/article/details/88622995