自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 收藏
  • 关注

原创 python-wx图形化界面

import wxapp=wx.App()frame=wx.Frame(None,title='第一个python程序',size=(300,150),style=wx.DEFAULT_FRAME_STYLE )panel=wx.Panel(frame)s=wx.StaticText(panel,label='欢迎来到python',pos=(60,40))frame.Show(True)app.MainLoop()'''使用wxpython建立GUI程序的步骤 (1)导入wx模块

2020-07-18 11:39:10 956

原创 python的json模块教学

import json#创建数字列表numbers=[2,3,5,7,11,13]#指定将数字列表储存到其中的文件的名称filename='number.json'with open(filename,'w') as file_object: json.dump(numbers,file_object)# 第一个参数为要存储的数据,第二个参数为用于存储数据的文件对象im...

2020-02-02 13:02:18 155

原创 python的split()函数用来计算文本中单词的个数

#计算文件大约包含多少个单词filename='alice.txt'try: with open(filename,encoding='utf-8') as f_obj: contents=f_obj.read()except FileNotFoundError as e: msg=" sorry "+filename +"not exist" pri...

2020-02-02 13:01:39 3521

原创 python的异常处理

#异常处理格式1try: print(5/0)except ZeroDivisionError: print("You can't divide by zero! ")#异常处理格式2print("Give me two numbers,and I'll divide them ")print("Enter 'q' to quit")while True: f...

2020-02-02 13:00:01 132

原创 python的文件教学

#函数open(参数:要打开的文件的名称)#关键字with 不需要访问文件后可以将其关闭#方法read()读取文件全部内容with open ('pi_digits.txt') as file_object:# 默认是只读方式'r' contents=file_object.read() print(contents) print("\n")#文本存储在文件夹中...

2020-02-02 12:58:58 143

原创 python的面对向程序设计“类”的教学

#Car类class Car(): """一次模拟汽车的简单尝试""" def __init__(self,make,model,year):# 以self为前缀的变量都可供类中所有的方法使用 """初始化描述汽车的属性""" self.make=make self.model=model self.year=ye...

2020-01-31 11:57:08 164

原创 python的函数教学

#定义函数def greet_user(): """显示简单的问候语""" print("Hello!")greet_user()#向函数传递信息def greet_user(username): """显示简单的问候语""" print("Hello, "+username.title()+"!")greet_user('corey')#位置实参...

2020-01-29 15:35:52 636

原创 python的while以及input()教学

#函数input()的工作原理message=input("Tell me something ,and I will repeat it ")print(message)#编写清晰的程序name=input("please enter ypur name : ")print("hello, "+name+"!")prompt="If you tell us "prompt+="\...

2020-01-27 11:25:30 596

原创 python的字典教学

#一个简单的字典alien_0={'color':'green','points':5}# 字典是由多个键值对组成的print(alien_0['color'])print(alien_0['points'])#访问字典中的值alien_0={'color':'green','points':5}new_points=alien_0['points']print("you just...

2020-01-25 12:01:02 176

原创 python起步变量教学

#使用方法修改字符串的大小写message="welcome"# ""之间是字符串print(message)message="abc"print(message)name="yu wenfei"print(name.title())# .title是首字母大写name="yu wenfei"print(name.upper())# .upper是全部字母大写name="Y...

2020-01-23 10:21:33 135

原创 python的列表教学

#列表是什么bicyles=['trek','cannondale','redline','specialize']print(bicyles)#访问列表元素bicyles=['trek','cannondale','redline','specialize']print(bicyles[0])# 索引从0开始print(bicyles[-1])# -1代表从最后一个数开始prin...

2020-01-23 10:20:19 511

原创 python的列表操作教学

#遍历整个列表magicians=['alice','david','carolina']for magician in magicians: print(magician)# 不要忘记冒号,记住要缩减#在for循环中执行更多的操作magicians=['alice','david','carolina']for magician in magicians: print...

2020-01-23 10:18:29 300

原创 python的if语句教学

#条件测试cars=['audi','bmw','subaru','toyota']for car in cars: if car=='bmw':# 注意有冒号 print(car.upper()) else: print(car.title())#检查是否相等car='audi'print(car=='audi')# 结果为true...

2020-01-23 10:17:24 1037

原创 稀疏矩阵

**稀疏矩阵的压缩**#include<stdio.h>#include<malloc.h>#define MAXSIZE 10000typedef struct{ int x,y; int e;}Triple;typedef struct{ Trip...

2019-09-26 23:48:55 133

原创 矩阵的鞍点

**关于矩阵鞍点的操作**#include <stdio.h>int main(){ int a[100][100] = {0}; int n; int row = 0,col = 0; printf("请输入正方矩阵的长度:"); scanf("%d",&n...

2019-09-25 21:16:24 473

原创 关于队列的入队,出队,遍历操作

**队列的操作**#include<stdio.h>#include<malloc.h>#define MAXQSIZE 10typedef struct{ int *base; int front; int rear;}SqQueue;void InitQueue(SqQueu...

2019-09-24 19:38:54 1299

原创 关于链表的创建,删除,增添,遍历

**链表的操作**#include<stdio.h>#include<stdlib.h>#include<conio.h>struct link{ int data; struct link *next;};struct link*creat(struct link*head)/...

2019-09-23 21:39:43 121

原创 栈的数值转化

**栈的数值转化**#include<stdio.h>#include<malloc.h>#include<stdlib.h>#define STACK_INIT_SIZE 10#define STACKINCREMENT 5typedef struct{int...

2019-09-22 11:15:21 1304

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除