自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

少儿编程侯老师的博客

专注少儿python学习,分享学生python学习成果,学习心得

  • 博客(58)
  • 收藏
  • 关注

原创 runze - 用python学习文件操作

# 1。open# 2。构造文件地址C:\Users\jrcode02\Desktop\新建文件夹\text.txt# 读取文件 read write# f = open(r'C:\Users\jrcode02\Desktop\新建文件夹\test.txt','r')# content = f.read()# print(content)# f.close() # 关闭文件# # 写...

2019-11-30 18:50:37 132

原创 Nancy -使用python来学习tkinter做界面化程序

import tkinter# 加载 loading 初始化# 1。初始化myWindow = tkinter.Tk()# 2。设置长宽myWindow.geometry("900x600")myWindow.title("阿坤都可以")# Label 标签tkinter.Label( myWindow, text = "你的电脑中病毒了", bg = "b...

2019-11-30 11:38:42 155

原创 Deqin - 用python来获取时间

timeimport time# 1970.1.1# t1 = time.time()# print(t1)# time.sleep(2)# t2 = time.time()# print(t2)# local 本地的 localtiont1 = time.localtime()# print(t1)# week day 0 1 2 3 4 5# year day# is...

2019-11-30 10:45:16 127

原创 Qiyuan -tkinter学习

import tkinter# 初始化一个界面窗口myWindow = tkinter.Tk()# 给一个窗口大小myWindow.geometry("900x900")myWindow.title("阿坤")# 1.label 标签功能var = tkinter.StringVar()a = 1def num(): global a a = a+1 pr...

2019-11-30 09:47:58 103

原创 Tina -python发微信查询天气

import requestsimport jsonimport city# 1.构建网址cityname = input("你住在哪里呀?")city_code = city.citycode[cityname]# url = "http://t.weather.sojson.com/api/weather/city/101010100"url = "http://t.weathe...

2019-11-30 08:45:55 152

原创 Tianxu -使用python的列表来描述王者荣耀

hero1 = "梦奇"hero2 = "亚瑟"# 数据存储类型 列表 []# 纸条 123有序# 计算机数数 012345hero = ['梦奇','亚瑟','赵云','马超','关羽']print(hero)# 增加 删除 修改 查找# 1。查找 [起始位置:结束位置]print(hero[2:4]) # 左闭右开# print(hero[3,4])# 2.修改...

2019-11-29 20:45:15 289

原创 binrui -初学python

# 学画画import turtle# important 重要的 import 导入# turtle 这是一个名字叫乌龟的画画工具包# 注释turtle.color("blue")# 画一笔 往前走 forwardturtle.forward(100)turtle.right(90)turtle.forward(100)turtle.right(90)turtle.forw...

2019-11-28 20:53:39 177

原创 Jack- 初学python

import turtle# import导入 important重要的# turtle 乌龟# 导入一个名字叫海归的可以用来画画的工具包# 注释:帮助我们解释代码# colorturtle.color("blue")# 划线 forward 向前走turtle.forward(100)# 转弯 左 left 右 rightturtle.left(90)turtle.forw...

2019-11-28 17:01:07 141

原创 harry - 用类和对象做吃鸡的人物角色

# 变量 玩家姓名 血量 能量值 nl energy # 类别 ---》图纸 def __init__(self, name, color): self.name = name self.hp = 100 self.energy = 0 self.colth = color # 函数 跑run 攻击a...

2019-11-27 21:46:41 166 1

原创 Alex- tkinter的学习

import tkinter# 1.初始化mywindow = tkinter.Tk()# 3.设置标题mywindow.title("阿坤GUI")# 4.给一个屏幕大小长x宽mywindow.geometry('1200x900')# 5.设置能不能改变尺寸 resizemywindow.resizable(width=False, height=False)# 设置lab...

2019-11-27 20:51:10 236

原创 harry - 记录程序运行的时间

import timestart_time = time.time()# 计算1-100的和a = 0for i in range(10000000): a = a+iprint(a)end_time = time.time()print("计算1-1亿的花费时间为%f秒"%(end_time-start_time))# 吃鸡的时间 开始的时间 结束的时间...

2019-11-25 21:41:09 79

原创 Qiyuan - python批量修改文件名

import osdd = os.getcwd()print(dd)# os.mkdir(dd+'\\'+"英雄商城")name = "达摩.典韦.曹操.钟无艳.墨子.赵云.吕布.孙悟空.关羽.杨戬.哪吒露娜.兰陵王.李白.花木兰.程咬金.白起.刘禅.庄周.项羽.廉颇." \ "牛魔.张飞.钟馗.刘邦.雅典娜.亚瑟.夏侯惇.韩信.老夫子.宫本武藏.荆轲.张良.安琪拉.貂蝉....

2019-11-25 20:01:55 133

原创 Tina- 和机器人对话

import requestsdef reply(talk): # 1。构建网址 url = "http://www.tuling123.com/openapi/api?key=d8dee202a87940bd866332938dd9ec52&info=" url = url+talk # 2.发送请求 r = requests.get(url,...

2019-11-25 20:01:37 321

原创 学习问题回顾

import turtleqlist = ['整数在python中是用什么表示的?', 'python中输出是什么语句', 'python里turtle是干嘛的', '条件判断的关键字是什么?', 'RGB能描述多少种颜色?']alist = ['int','print','画画的','elif','255']tabli...

2019-11-24 19:48:58 126

原创 xinxin -用while循环计算皇帝的棋盘

import turtle# for循环for i in range(5): turtle.fd(100) turtle.left(144)# while循环a = 0while a<5: a=a+1 turtle.fd(100) turtle.left(144)turtle.done()# if# if 1>0:# p...

2019-11-24 19:45:48 293

原创 kewin - 接小球游戏

import pygameimport random# 1.loading 初始化pygame.init()# 2.窗口 dis分开 play玩 ----》 展示screen = pygame.display.set_mode((700, 600))# 3.游戏名字 caption标题pygame.display.set_caption("接小球游戏")ballx1 = 3...

2019-11-24 14:44:50 252

原创 boren-文件夹操作

import osimport shutil# os.mkdir("皮肤/皮肤")# 1.rename 重命名# os.rename("皮肤","皮肤商城")# os.rename("皮肤商城/皮肤","皮肤商城/皮肤1")# for i in range(2,1000):# os.mkdir(r"皮肤商城/皮肤%d"% i)# 2. listdir 列出所有文件# na...

2019-11-24 11:47:20 164

原创 Kobe - python画太极图

import turtledef yu(radius,color1,color2): turtle.shape("turtle") turtle.speed(0) turtle.color("black", color1) turtle.begin_fill() turtle.circle(radius/2, 180) turtle.circl...

2019-11-24 09:49:26 862

原创 harry -读取,写入,新建文件- with语句

# 1.读取文件# f = open("pubg.text", 'r')# # content = f.read() # 读取# # print(content)# # f.close() # 关闭文件# # # 2 写入文件# # f = open('pubg.text','w')# # f.write("i want to eat chicken")# # f.close(...

2019-11-23 20:45:25 146

原创 Runze - python file

import os# 1。查找文件地址 current directory addressaddr = os.getcwd()print(addr)# 2. 新建文件夹 make directory# os.mkdir("皇室战争")# 3。1 跳转文件地址 change directoryos.chdir(r"C:\Users\jrcode01\Desktop"...

2019-11-23 18:56:11 123

原创 python-python文件地址

import os# 1.获得当前文件地址addr = os.getcwd()print(addr)# 2.新建文件夹 make directory 文件夹# os.mkdir("王者荣耀")# 3.1绝对地址try: # os.mkdir(r'C:\Users\jrcode02\Desktop\王者荣耀') # 3.2 跳转文件地址 新建 change改变 ...

2019-11-23 17:15:17 441

原创 succi - 猜拳游戏

"""拳头 1 布2 剪刀31.输电脑 我们 结果1 3 -12 1 13 2 12. 赢电脑 我们 结果1 2 -12 3 -13 1 23。平局电脑 我们 结果1 1 02 2 ...

2019-11-23 14:45:13 167

原创 Succi-学习python判断if,else,元气骑士

# 上火车#piao = input("你有几张票呀") # 字符串piao = int(piao)# 判断符号 > < == >= <= !=if piao > 0: print("请进站") boom = int(input("你有几个炸弹")) if boom>0: print("别跑,关门放...

2019-11-23 14:39:27 672

原创 Nancy - python知识回顾

# 学习啥是pythonimport turtle # 叫做乌龟的一个画画工具包# 变量:# 法无禁止即自由# turtle.color('blue')# 数据存储类型# 数字 + - * / // 取不大于结果de最大整数 % 余数 **# 字符串 ' ' " "# 列表 [ ]# 字典 {}# 元组 () 不能修改# 布尔表达式 True ...

2019-11-23 11:53:26 147

原创 Qiyuan - 面向对象

class Yase: def __init__(self,ni): self.nicheng = ni self.name = "亚瑟" self.__ph = 3660 # 隐藏属性 def getph(self): return self.__ph def setph(self,newph): ...

2019-11-23 09:41:35 222

原创 Deqin -python文件和文件地址

import osaddr = os.getcwd()print(addr)# make directory# os.mkdir('第五人格')# 1.跳转空间,然后新建# # change directory# os.chdir(r'C:\Users\jrcode02\Desktop')# # os.mkdir('第五人格')# os.chdir(r'第五人格')# os.m...

2019-11-22 19:51:08 221 1

原创 harry - python文件学习

import osaddr = os.getcwd() # 获得当前文件地址print(addr) # 打印# 绝对地址 "C:\ProgramData\Anaconda3\python.exe"# 相对地址 ".."# \ 斜杠 反义字符 反应原来的意义# 在字符串里使用# 消除反义字符# 敌人的敌人就是朋友print("123\\n123")# reverseprin...

2019-11-20 21:49:56 91

原创 harry - python画太极图

import turtleturtle.shape('turtle')turtle.speed(5)turtle.color("black","black") # 边线的颜色 填充颜色turtle.begin_fill() # 开始填充turtle.circle(100,180)turtle.circle(200,180)turtle.lt(180)turtle.cir...

2019-11-18 21:51:52 652

原创 Qiyuan - python表示时间和月份

import calendarcal = calendar.month(2019,11)print(cal)import timet1 = time.time()sum = 0for i in range(100000000): sum = sum + iprint(sum)t2 = time.time()print(t2-t1)import timet1 = ...

2019-11-17 20:46:17 201

原创 kewin-用python函数画太极图

import turtle as tdef yu(radius, color1, color2): t.color("black", color1) # 边的颜色,填充颜色 t.begin_fill() # 开始填充 # circle 圆形 t.circle(radius / 2, 180) t.circle(radius, 180) t....

2019-11-17 14:51:14 408

原创 Kobe- 多啦A梦图

# Drawcat 画多啦一梦from turtle import *# 无轨迹跳跃def my_goto(x, y): penup() goto(x, y) pendown()# 眼睛def eyes(): tracer(False) a = 2.5 for i in range(120): if 0 <= i...

2019-11-17 09:46:08 297

原创 Jason-通过的python的you-get下载各种视频方法

1. 打开窗口:win+R 输入cmd再回车2. 下载python一个第三方工具包:输入pip install you-get3. 下载电影:you-get https://www.bilibili.com/bangumi/play/ep245511

2019-11-16 21:49:00 605

原创 Succi - 用元气骑士学习python的列表

hero1 = '刺客吸血鬼骑士'hero2 = '狼人'# 数据存储类型 - 列表 []hero = ['狼人', '吸血鬼', '骑士', '狂战士', '德鲁伊']print(hero)# 增 删 改 查# 1. 查找 左闭右开 左边关闭能取到这个数字 右边打开取不到这个数字print(hero1[2:7])print(hero[1:3])# 2. 增加 appe...

2019-11-16 14:41:39 1406

原创 Qiyuan -文件的读取和写入

# 打开 open# \ 反义字符# \\ / r - reverse# 读取文件f = open('.\\file\木马.txt','r')content = f.read(10)print(content)f.close()## # 写入文件,w覆盖文件f = open('.\\file\木马.txt','w')f.write("电脑又被攻破,你完了,哈哈")f.c...

2019-11-16 09:45:24 180

原创 Tina -python知识回顾

1.0import turtle# blue# 变量名的命名规则:1。变量名是由字母,数字,下划线组成的# 2。数字不能作为开头,不能有标点符号(下划线除外)# hwgduioh f________ _______3_______ 134sdvuiagh h-qwrfegets 你好# 法无禁止即自由# 数字# 字符串a = ['hou', '张婷雅', '王俊凯'] ...

2019-11-16 08:47:24 322

转载 如何将python代码转成exe可执行文件---使用pyinstaller工具包

文章目录1.安装pyintsaller包2.在cmd里输入打包文件的语句问题总结3.1 一闪而过怎么办?3.2 打包后的文件太大怎么办?3.3 缺少相关素材3.4 关于图标的ico文件去哪里转3.5 图标加载进去不显示怎么办3.6 打包的时候加入素材4. pyintsaller --help5有什么问题大家留言讨论哈1.安装pyintsaller包在cmd里输入pip install py...

2019-11-13 19:37:52 678 1

原创 harry -学习python的函数用法

# 函数:商店老板、# 教def landlord(): print("懒得劳动") print("不想劳动") print("不想劳") print("不想") print("不")# 叫landlord()import turtledef ll(): turtle.fd(100) turtle.lt(144) tu...

2019-11-12 21:52:53 130

原创 harry - python初级阶段总结

1.画画:import 导包复杂的图画用代码更简单import turtleturtle.speed(0)for i in range(1000): turtle.forward(i) turtle.left(123)turtle.done()2.变量变量来存储数据3.变量存储的数据类型3.1 数字 + - * /3.2 字符串 ’ ’ , " "3.3...

2019-11-11 21:44:07 175

原创 Xinxin -用python来做界面化猜拳游戏

"""石头 剪刀 布"""import easygui # gui 界面import random# 出拳win = 0lose = 0draw = 0punches = ['石头', '剪刀', '布']computer = random.choice(punches)user = easygui.enterbox("大佬请出拳,请出剪刀石头布")#...

2019-11-10 19:48:39 645

原创 Zixiang - python学习判断语句

# 只剩1个人,你的血量得大于0ph = input("剩余多少血")ph = int(ph)person = int(input("剩余多少人"))if 100> ph > 0 : print("还有的玩") if person== 1: print("大吉大利,今晚吃鸡") elif person> 1: pr...

2019-11-10 15:45:15 162

空空如也

空空如也

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

TA关注的人

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