摘要: 1.安装Python3.6 安装准备 编译安装 将默认Python修改为Python3.6,并为其创建软连接 修改yum使用的原python的配置文件 2.安装pip3 安装pip依赖库 如果安装上述依赖库出现以下报错:Delta RPMs disabled because /usr/bin/app 阅读全文
posted @ 2019-08-27 19:28 才华配得上梦想 阅读(2656) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-08-27 18:58 才华配得上梦想 阅读(87) 评论(0) 推荐(0) 编辑
摘要: python2 字符串 阅读全文
posted @ 2019-08-27 18:46 才华配得上梦想 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 文本文件 二进制文件 # 打开文件 file = open("README") # 读取文件 text = file.read() print(text) # 关闭文件 file.close() # 打开文件 try: file = open("README") except Exception a 阅读全文
posted @ 2019-08-27 08:48 才华配得上梦想 阅读(77) 评论(0) 推荐(0) 编辑
摘要: from distutils.core import setup setup(name=“hm_message”, # 包名version=“1.0”, # 版本description=“itheima’s 发送和接收消息模块”, # 描述信息long_description=“完整的发送和接收消息 阅读全文
posted @ 2019-08-27 07:58 才华配得上梦想 阅读(83) 评论(0) 推荐(0) 编辑
摘要: from . import send_message from . import receive_message def receive(): return "这是来自100xx的短信" def send(text): print("正在发送%s" % text) import hm_message 阅读全文
posted @ 2019-08-26 19:47 才华配得上梦想 阅读(75) 评论(0) 推荐(0) 编辑
摘要: import hm_01_测试模块1 import hm_02_测试模块2 hm_01_测试模块1.say_hello() dog = hm_01_测试模块1.Dog() print(dog) hm_02_测试模块2.say_hello() cat = hm_02_测试模块2.Cat() print 阅读全文
posted @ 2019-08-23 21:33 才华配得上梦想 阅读(123) 评论(0) 推荐(0) 编辑
摘要: def demo1(): return int(input("请输入一个整数")) def demo2(): return demo1() # 利用异常的传递性 ,在主程序捕获异常 try: print(demo2()) except Exception as result: print("未知错误 阅读全文
posted @ 2019-08-23 20:50 才华配得上梦想 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 捕获异常 try: .. except: ... try: num = int(input("请输入整数:")) except: print("请输入整数") 捕获未知错误 try: 阅读全文
posted @ 2019-08-22 23:09 才华配得上梦想 阅读(82) 评论(0) 推荐(0) 编辑
摘要: class MusicPlayer(object): # * 元组 ** 字典 def __new__(cls, *args, **kwargs): # 使用类名创建对象,new方法会被自动调用 print("创建对象,分配空间") # 2 为对象分配空间 instrance = super()._ 阅读全文
posted @ 2019-08-22 21:19 才华配得上梦想 阅读(85) 评论(0) 推荐(0) 编辑