在基础知识部分的最后一章《第十三章Python基础篇结束章》的《第13.3节图形界面开发tkinter》简单介绍了Python内置图形界面标准库tkinter,当时特别强调tkinter没有图形开发的设计界面,使用复杂,且存在功能问题不推荐使用,将学习朋友推荐的PyQt。本章正式进入PyQt相关内容的学习,注意PyQt是GPL软件(GPL是GNUGeneralPublicLicense的缩写,是GNU通用公共授权非正式的中文翻译),不适合用于商用开发。但P
系统 2019-09-27 17:50:44 1921
学了一个多月的python,做了一个小程序:python实现简单成绩录入系统,实验一下menu部分fromtkinterimport*#这是一个python模块,python3中都有importtkinter.messagebox#这也是一个模块fromfile_readimportreadfromfile_writeimportwriteclassstudent_main():#定义一个学生类def__init__(self):self.name=''s
系统 2019-09-27 17:50:34 1921
pipinstalltusharestock_price.py#coding:utf-8importos,sysimportdatetimeimportmatplotlib.pyplotaspltimportpandasaspdimporttushareastsiflen(sys.argv)==2:code=sys.argv[1]else:print('usage:pythonstock_price.pystockcode')sys.exit(1)ifle
系统 2019-09-27 17:50:25 1921
预先设置数字变量age_of_test=25#这里设置为25,也可随意guess_age=int(input("guessage:"))ifguess_age==age_of_test:print("Yes,yougotit!")#判断正确后打印Yes,yougotit!并继续执行命令elifguess_age>age_of_test:print("thinksmaller...")#判断数字小于预定值时提示!else:print("thinkbigger
系统 2019-09-27 17:49:37 1921
1.可传入参数:@app.route('/user/')#常用的不加参数的时候默认是字符串形式的@app.route('/post/')#常用的#指定int,说明是整型的@app.route('/post/')@app.route('/post/')@app.route('/login',methods=['GET','POST'])DEFAULT_CONVERTERS={'default':UnicodeConverter,'string':Unicod
系统 2019-09-27 17:49:32 1921
这里使用pipe代码如下:importtimefrommultiprocessingimportProcessimportmultiprocessingclassD:@staticmethoddeftest(pipe):whileTrue:foriinrange(10):pipe.send(i)time.sleep(2)@staticmethoddeftest2(pipe):whileTrue:print('test2value:%s'%pipe.recv
系统 2019-09-27 17:49:29 1921
原文链接:https://my.oschina.net/xiaocon/blog/199414finally关键字的意思是只要异常,到最后都会执行语句块。。。#!/usr/bin/pythonimporttimetry:f=file('poem.txt')whileTrue:line=f.readline()iflen(line)==0:breaktime.sleep(2)printline,finally:f.close()print'file.clos
系统 2019-09-27 17:49:21 1921
本文实例讲述了Python文件的读写操作。分享给大家供大家参考,具体如下:读写文件读取文件f=open('my_path/my_file.txt','r')#open方法会返回文件对象file_data=f.read()#通过read方法获取数据f.close()#关闭该文件首先使用内置函数open打开文件。需要文件路径字符串。open函数会返回文件对象,它是一个Python对象,Python通过该对象与文件本身交互。在此示例中,我们将此对象赋值给变量f。
系统 2019-09-27 17:49:16 1921
PIL图片操作读取图片img=Image.open(“a.jpg”)显示图片im.show()#im是Image对象,im是numpy类型,通过Image.fromarray(nparr,mode='RGB')函数转换为Image对象图片的size(width,height)=img.size图片的模式mode=img.mode截区域img_c=img.crop(x1,y1,x2,y2)裁剪图片img=img.resize((size,size),Imag
系统 2019-09-27 17:48:58 1921
python基础学习笔记(十)2013-05-0800:30虫师阅读(...)评论(...)编辑收藏魔法方法、属性------------------------准备工作为了确保类是新型类,应该把_metaclass_=type入到你的模块的最开始。classNewType(Object):mor_code_hereclassOldType:mor_code_here在这个两个类中NewType是新类,OldType是属于旧类,如果前面加上_metacla
系统 2019-09-27 17:48:53 1921