当前位置:首页 > Python

Python

  • 最新
  • 浏览
  • 评论

random库

Doraemon4年前 (2020-02-16)Python3957
random库
random()            生成一个[0.0,1.0)之间的随机小数randint(a,b)     生成一个[a,b]之间的整数uniform(a,b)     生成一个[a,b]之间的随机小数对random库的引用方法与math库一样,采用下面两种方式实现:import random...

搜索字符串

Doraemon4年前 (2020-02-16)Python3904
搜索字符串
常用搜索字符串中子串的方法str.count(substring)      返回str中substring子串出现的无覆盖的次数str.find(s1)                    返回s1在这个字符串的最低下标,如果字符串中不存在s1,则返回-1str.rfind(s1)       ...

索引运算符【】

Doraemon4年前 (2020-02-16)Python3880
  索引运算符【】
选择字符串的子序列语法【start:finish】        start:子序列开始位置的索引值        finish:子序列结束位置的下一个字符的索引值如果不提供start或者finish,默认start为第一个字符,finish为最后一个字符。例如...

for循环

Doraemon4年前 (2020-02-15)Python3844
for循环
range()函数range(start,end,step)range()函数返回一个可迭代对象(可理解为一个序列,序列中的数包括start,不包括end)例如range(1,101),返回1-100的序列。range(101),范围0-100的序列。range(1,100,2),返回1,3,5.....

math库的使用

Doraemon4年前 (2020-02-06)Python4248
math库的使用
math库包括4个数学常数math.pi      圆周率math.e       自然对数math.inf     正无穷大,负无穷大为-math.infmath.nan     非浮点数标记math库常用函数math.cell(x)  &nbsp...

Python关于turtle的函数名

Doraemon4年前 (2020-02-02)Python3691
Python关于turtle的函数名
turtle.forward(distance)                   向当前画笔方向移动distance像素长度turtle.backward(distance)           ...

2.Python中的基本运算

chanra1n4年前 (2020-01-20)Python3822
2.Python中的基本运算
我们打开Python,请你尝试输入如下算式并尝试理解有什么为什么是这样的?1+1 1+1.0 1-2 2-3.5 1*1 1*1.1 1/2 2/1 2/3 3/2 3//2 3/1.0 5/2.5我们不难得到如下结果2 2.0 -1 -1.5 1 1.1 0.5...

1.Python基本的使用

chanra1n4年前 (2020-01-20)Python4457
1.Python基本的使用
我们打开python或者通过运行python也可以,请复制如下代码,然后按下Enter键,看看会发生什么?print('\n'.join([''.join([('MyFpga'[(x-y) % len('MyFpga'...

0.Python环境的搭建

chanra1n4年前 (2020-01-20)Python4306
0.Python环境的搭建
   请打开网页  https://www.python.org/downloads/windows/    Windows环境下的Python        这里我选择...

安徽高考成绩批量查询-多种方法实现-python版本

fengss7664年前 (2019-12-13)Python4603
安徽高考成绩批量查询-多种方法实现-python版本
...