Python 开平方

#!/user/bin/python3
#files :using_sys.py

f = open("filename.txt","r+")
num = f.read()
f.close()
lstnum = num.split('\t')
a,b = int(lstnum[0]),float(lstnum[1])
print(type(a),type(b))
print(a,b)
ret = a ** b
print(ret)

从文件读取基数a和指数b,运算出结果

需要考虑问题:

1. 如果数据为null

2. 大数据

3. 字母,特殊字符  使用isnumber判断

4. 文件不存在

5. 多个数字

待优化

将数据结果,换成EXEL

 

posted @ 2016-12-04 16:24  龙の隐  阅读(777)  评论(0编辑  收藏  举报