Define tuple as key in a dictionary,definetuple,Matrix = {}M
Define tuple as key in a dictionary,definetuple,Matrix = {}M
Matrix = {}Matrix[(2,3,4)] = 88Matrix[(7,8,9)] = 99X = 2; Y = 3; Z = 4 # ; separates statementsprint Matrix[(X,Y,Z)]print Matrixif Matrix.has_key((2,3,6)): # check for key before fetch print Matrix[(2,3,6)]else: print 0
- Match two string,matchtwostring,seq1 = 'spam
- String method: to lower case,methodlower,quote = 'Pyt
- Finding a substring in a string,findingsubstring,strin
- Demonstrates the use of quotes in strings,demonstrates
- An index that is too large is replaced by the string siz
- String JOIN,stringjoin,print 'SPAM'
热门文章:
相关内容
- Match two string,matchtwostring,seq1 = 'spam
- String method: to lower case,methodlower,quote = 'Pyt
- Finding a substring in a string,findingsubstring,string2 = 'O
- Demonstrates the use of quotes in strings,demonstratesquotes,print
- An index that is too large is replaced by the string size,largerepl
- String JOIN,stringjoin,print 'SPAM'
- Printing a List,printinglist,li = ['a', '
- Quotation inside a quotation,quotationinside,print 'knigh
- String slicing: extrace section,slicingextrace,S = 'spam'pr
- Splitting strings,splittingstrings,string1 = 'A
评论关闭