Python: Tuples, Sets, Fractions, Types
作者:互联网
Tuples:
T = (1, 2, 3, 4)
len(T)
T + (5, 6)
T.index(4)
T.count(4)
#Tuples are immutable
Sets:
T = (1, 2, 3, 4)
len(T)
T + (5, 6)
T.index(4)
T.count(4)
#Tuples are immutable
Fractions:
from fractions import Fraction
f = Fraction(2, 3)
f+1
f + Fraction(1, 2)
Types:
L = [2, 3, 4]
type(L) #<class 'list'> for 3.0 or higher
isinstance(L, list) #True
转载于:https://www.cnblogs.com/kongs/archive/2011/10/28/2227987.html
标签:Fractions,index,Python,Tuples,Fraction,immutable,Types 来源: https://blog.csdn.net/weixin_34326558/article/details/93394979