>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
>>>
不管输入什么类型的字符,返回都是字符型的
>>> a=input("请输入:")
请输入:123
>>> print(type(a))
<class 'str'>
>>> type(a)
<class 'str'>
>>> b=input()
ads
>>> print(b)
ads
>>> print(type(b))
<class 'str'>
>>> c=input()
12.3
>>> print(type(c))
<class 'str'>
>>> print(c)
12.3
一次可以有多个输入,调用split()函数,调整输入的间隙控制符
a,b,c =input(":").split(',')#用‘,’隔开
d,e,f =input(':').split(' ')#用‘ ’隔开
print(a,b,c)
print(d,e,f)
x**y:计算x的y次方
如果加入第三个参数,则结果对第三个参数取余
即:222%5=3
range(stop) — 依次生成一个(0~stop)的数
例如:
range(5)
打印输出:
0
1
2
3
4
range(start,stop) — 依次生成一个(start~stop)的数
例如:
range(5,10)
打印输出:
5
6
7
8
9
range(start,stop,step) — 依次生成一个(start~stop)的数,跨度为step
例如:
range(3,10,2)
打印输出:
3
5
7
9