搜索[''[0]],共找到13个文章
自古以来的Python笔记
管你看没看懂,点赞就完啦啊啊啊 str表示字符串 float小数 int整数 python当中双引号和单引号没什么区别 但是两个不能连用 'nihao' 'nihao' 这两个是对的 'nihao'这个是错的 当布尔值加入数学运...
Python游戏趣味编程(二)
勇闯地下一百层 按键说明 keyboard.up 按下键盘向上方向键 keyboard.down 按下键盘向下方向键 keyboard.a 按下键盘上的A键 keyboard.space 按下键盘上的空格键 keyboard. k_0 按下主键盘上的数...
Python趣味游戏编程
弹跳的小球 绘制一个圆 import pgzrun def draw(): '''position radius color''' screen.draw.circle((400,300),10,'yellow') pgzrun.go() #绘制实心圆 screen.draw.filled_circle((400,3...
用Python学数学(二)
用类构建对象弹跳球程序让小球动起来 xcor = 300 ycor = 300 xvel = 1 yvel = 1 def setup(): size(600,600) def draw(): global xcor,ycor,xvel,yvel background(0) xcor += xvel ycor...
Python学数学(一)
用几何学变换形状 translate(50,80) # 会将整个网格向右移动50像素,向下移动80像素 #将图形绕着原点进行旋转 rotate() #参数为弧度 rotate(radians(20)) #将角度转换为弧度 画一个圆圈图案 def...
5.字符串和文本(二)
从字符串中去掉不需要的字符使用strip()来去除字符串两边的字符使用lstrip()来去除左边字符使用rstrip()来去除右边的字符s = ' hello,world,' #去除空格 print(s.strip()) #去除右边的符号 prin...
4.字符串和文本(一)
针对任意多的分隔符拆分字符串可以使用re.split()来使用多个分隔符来分割字符串import re line= 'assd sdfsd; sdfs,sdf,adsdf, foo' result=re.split(r'[;,\s]\s*',line) print(result) #['assd...