# 注释
"""
多行注释
"""
import keyword
import random
import os
global g_var0
def outer_func(a, b):
d =a+b
def inner_func(c):
print(d+c)
return inner_func
if __name__=='__main__':
print(keyword.kwlist)
"""
False None True and as assert
await break class continue def del
elif else except finally for from
global if import in is lambda
nonlocal not or pass raise return
try while with yield async
"""
for x in [1,2,3,4,5]:
print(x)
id(x)
type(x)
x=y=z = 5
q,w,e= 'a','b','c'
isinstance(q,float)
x * y
x ** x
x / y
x // y
if x > y:
print()
elif y < x:
print()
else:
print()
del e
for i in range(1,2):
print()
continue
c = input("jj")
random.random
s = 'dsghkjhaklsg' \
'sdfsdfsdfsdf'
s = ('sdfsdfdsfsd'
'sdfsdfsdsdf')
len(s)
s[0]
s.count("a")
li = [[],[]]
li = [tmp ** tmp for tmp in range(0,9) if tmp % 8 ==0]
list()
li.sort(reverse=False)
li.append(li)
li.pop()
g_var0 = ()
tuple()
set()
kv = {}
kv.keys()
kv.values()
kv.items()
for key in kv:
print(key, kv.get(key))
for key in kv.keys():
print(key, kv.get(key))
for key,value in kv.items():
print(key, value)
"%sx,%sy,%sz" % (x,y,z)
"{},{},{}".format("a","b","c")
(lambda num1,num2:num1+num2)(1,2)
lambda x, y : exec('print(""); global return_value; return_value = x + y')
func = outer_func(1, 2)
func(3)
f = open('vars.py', encoding='utf-8')
f.read()
f.readline()
f.readlines(20)
# f.write('123')
# f.seek(-3, 2)
f.tell()
f.close()
# os.remove("")
# os.mkdir()
# os.rmdir()
r""
try:
raise FileNotFoundError
except FileNotFoundError as error:
print(error)
else:
print()
finally:
print()
转载于:https://www.cnblogs.com/mrerror/p/10916322.html