python语法学习
1.整除与幂运算
>>> 5.6//2
2.0
>>> 2**3
8
>>>
2.位移与异或算法
>>> 1<<1
2
>>> 1>>1
0
>>> 1^2
3.字符串
>>> str="abcde"
>>> str[1:4]
'bcd'
>>> str[2:]
'cde'
>>> str[::1] //表示一步一取
'abcde'
>>>
3
>>> 2^3
1
>>> str[-1]
'e'
>>> str*2
'abcdeabcde'
>>> "c" in str
True
>>>
4.元组定义
>>> t=("a","b")
>>> t
('a', 'b')
>>> t[0]
'a'
>>>

浙公网安备 33010602011771号