Python

来源:互联网 发布:不安全网络怎么解决 编辑:程序博客网 时间:2024/05/16 03:40

//输入



name = input()//直接转义特殊字符串s3 = r'Hello, "Bart"'//输出
 print(100 + 200)//输出带换行# print Stringprint('''abcd''')//输入带提示name = input('please enter your name: ')//if----else# print absolute value of an integer:# 关键字 or not and# 空值是Python里一个特殊的值,用None表示。None不能理解为0,因为0是有意义的,而None是一个特殊的空值。a = 100if a >= 0:    print(a)else:    print(-a)//编码转换
ord('A') = 65
ord('中') = 20013
chr(66) = A//转成Bytes传输
x = b'ABC//字符串对照%d整数%f浮点数%s字符串%x十六进制整数
'Hi, %s, you have $%d.' % ('Michael', 1000000)'Hi, Michael, you have $1000000.'

//数组操作函数
http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/0014316724772904521142196b74a3f8abf93d8e97c6ee6000
classmates.append('Adam')
classmates.insert(1, 'Jack')
classmates.pop()
classmates.pop(1)
//定义函数
def 关键字//数组函数reduce = implodesum = sumfilter = 筛选sorted = 排序

//16进制
1.23x109 = 1.23e9
0.000012 = 1.2e-5


0 0