上一页 1 2 3 4 5 6 7 ··· 15 下一页
摘要: import tkinter#创建主窗口win = tkinter.Tk()#设置标题win.title("sunck")#设置大小和位置win.geometry("400x400+200+20")#进入消息循环win.mainloop() 阅读全文
posted @ 2020-02-19 20:21 i勤能补拙 阅读(526) 评论(0) 推荐(0) 编辑
摘要: 描述: exec 执行储存在字符串或文件中的Python语句,相比于 eval,exec可以执行更复杂的 Python 代码。 需要说明的是在 Python2 中exec不是函数,而是一个内置语句(statement),但是Python 2中有一个 execfile() 函数。可以理解为 Pytho 阅读全文
posted @ 2020-02-19 17:13 i勤能补拙 阅读(269) 评论(0) 推荐(0) 编辑
摘要: #发邮件的库import smtplib#邮件文本from email.mime.text import MIMEText#SMTP服务器SMTPServer = "smtp.163.com"#发邮件的地址sender = "15999999999@163.com"#发送者邮箱的密码passwd = 阅读全文
posted @ 2020-02-19 16:22 i勤能补拙 阅读(216) 评论(0) 推荐(0) 编辑
摘要: # python使用互译无线发送手机短信# 接口类型:互亿无线触发短信接口,支持发送验证码短信、订单通知短信等。# 账户注册:请通过该地址开通账户http://sms.ihuyi.com/register.html# 注意事项:# (1)调试期间,请用默认的模板进行测试,默认模板详见接口文档;# ( 阅读全文
posted @ 2020-02-18 21:33 i勤能补拙 阅读(2470) 评论(0) 推荐(0) 编辑
摘要: print(1 + 2)print("1" + "2")#不同的类型用加法会有不同的解释class Person(object): def __init__(self, num): self.num = num #运算符重载 def __add__(self, other): return Pers 阅读全文
posted @ 2020-02-18 15:31 i勤能补拙 阅读(1333) 评论(0) 推荐(1) 编辑
摘要: class Person(object): def __init__(self, name, age): #属性直接对外暴露 #self.age = age #限制访问 self.__age = age self.__name = name ''' def getAge(self): return 阅读全文
posted @ 2020-02-17 20:59 i勤能补拙 阅读(231) 评论(0) 推荐(0) 编辑
摘要: from types import MethodType#创建一个空类class Person(object): __slots__ = ("name", "age", "speak")per = Person()#动态添加属性,这体现了动态语言的特点(灵活)per.name = "tom"prin 阅读全文
posted @ 2020-02-17 17:11 i勤能补拙 阅读(756) 评论(0) 推荐(0) 编辑
摘要: class Person(object): # 这里的属性实际上属于类属性(用类名来调用) name = "person" def __init__(self, name): pass #对象属性 self.name = nameprint(Person.name)per = Person("tom 阅读全文
posted @ 2020-02-15 10:58 i勤能补拙 阅读(526) 评论(0) 推荐(0) 编辑
摘要: 第一类多态:from cat import Catfrom mouse import Mousefrom person import Person'''多态:一种事物的多种形态最终目标:人可以喂任何一种动物'''tom = Cat("tom")jerry = Mouse("jerry")tom.ea 阅读全文
posted @ 2020-02-15 10:51 i勤能补拙 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 第一类多继承的实现:from Child import Childdef main(): c = Child(300, 100) print(c.money, c.faceValue) c.play() c.eat() #注意:父类中方法名相同,默认调用的是在括号中排前面的父类中的方法 c.func 阅读全文
posted @ 2020-02-14 12:15 i勤能补拙 阅读(530) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 15 下一页