输入
number1,number2=eval(input("Enter two numbers, separated by a comma")) //要用逗号隔开
文件读入
def main():
filename = input("What file are the numbers in?")
infile = open(fileName,'r')
sum=0.0
count = 0
line = infile.readline()
while line != "":
#为line中的值更新其count和sum
for xStr in line.split(",")
sum = sum+eval(sStr)
count = count +1
line = infile.readline()
print("\nThe average of the numbers is",sum/count)
main()