
python
GJXAIOU
博客更新较为缓慢,可以直接访问GitHub:https://github.com/GJXAIOU
展开
-
round()内置方法使用
round()不是简单的四舍五入的处理方式下面是引用的官方函数解释:For the built-in types supporting round(), values are rounded to the closest multiple of 10 to the power minus ndigits; if two multiples are equally close, rounding...原创 2018-11-06 18:32:03 · 4403 阅读 · 0 评论 -
如何简单地理解Python中的if __name__ == '__main__'
如何简单地理解Python中的if __name__ == '__main__'1.摘要通俗的理解__name__ == '__main__':假如你叫小明.py,在朋友眼中,你是小明(__name__ == '小明');在你自己眼中,你是你自己(__name__ == '__main__')。if __name__ == '__main__'的意思是:当...转载 2018-11-15 20:59:26 · 136 阅读 · 0 评论 -
python使用seek函数报错:io.UnsupportedOperation: can't do nonzero end-relative seeks
'''当前文件目录下mytest.txt文件内容如下:helllo,worldhahhaahhjjjjjjj''' #测试seek()函数代码fi =open("mytest.txt","r")fi.seek(-3,2)print(fi.read())fi.seek(5,0)print("第一次定位位置:",fi.tell())pri..原创 2018-11-21 22:06:48 · 7006 阅读 · 1 评论 -
python's super() considered super
英文原版地址点这里Python’s super() considered super!If you aren’t wowed by Python’s super() builtin, chances are you don’t really know what it is capable of doing or how to use it effectively.译:如果你并没有对pytho...翻译 2018-11-22 22:37:13 · 319 阅读 · 0 评论 -
《跟老齐学Python:轻松入门》学习笔记:章一:基础对象类型
第1章 基本对象类型浮点数的所有运算都要注意1.1 数和四则运算1.python可以自动处理大整数问题,不必担心溢出2.单精度浮点数(4个字节)在计算机内部存储方式:1位为符号位(0为正,1为负),8位用作整数,最后的23位表示有效数字3.每个对象在内存中都有自己的地址,可以使用函数id()查看每个对象的内存地址;但是通过id()得到的内存地址是只读的,不能够修改。4.使用函数typ...原创 2018-12-14 10:43:07 · 882 阅读 · 0 评论 -
使用pip3安装pandas出现错误
在ubuntu中使用pip3安装python库的时候,安装没有报错,但是在使用import,导包的时候出错,可能是pip3安装包的python版本和在终端中使用的python版本不同;例如:使用pip3安装pandas包sudo pip3 install pandas安装成功没有任何报错但是使用python3,然后import pandas时候却发现没有这个包说明:因为本人ubuntu...原创 2019-03-16 13:31:26 · 6560 阅读 · 0 评论