首页 > 编程语言 > 详细

Python 开平方

时间:2016-12-04 19:43:11      阅读:417      评论:0      收藏:0      [点我收藏+]
#!/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

 

Python 开平方

原文:http://www.cnblogs.com/O1Farmer/p/6131082.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!