Python

Pythonbasic formpropertyconcatenate c = a + b and c=a*3orderedmutablesliced: t[start:end:step]methods[ 1, "hello world", [5,6] ] #可以混存allow duplicate valuesListTuplebasic form(1,"hello world",[5,6] )propertyconcatenate c = a + b and c=a*3orderedimmutableallow duplicate valuessliced: t[start:end:step]Setbasic form{1,"hello world" }propertyunorderedimmutablenot allow duplicate valuesDictionarybasic form {"brand": "Ford", "model": "Mustang", "year": 1964}propertyorderedmutablenot allow duplicate keyappend, clear, copy, count, extend, index, insert, pop, remove, reverse, sort,How to join two listsHow to add one list to another listHow to copy a listsort()index()insert(), append() and extend()del(), remove() and pop()a.clear() and del(a)a.sort() and sorted(a)functionssum/max/min/len/sorted/enumeratetime complexityfunctionssum/max/min/lenmethodscount, indexHow to add elements to a tupleHow to creat a tuple with only one itemHow to add a tuple to a tuplesum(tup) and sum((tup1,tup2),())sum(lst) and sum((lst1,lst2),[])can you add an item to a set?Can you add an item to a tuple?Can you add a tuple to a tuple?methodsadd, clear, copy, difference, difference_update,discard, intersection, intersection_update,isdisjoint, issubset, issuperset, pop, remove,symmetric_difference, symmetric_difference_update,union, updateadd() and update()update() and union()union() and | operatorintersection_update() and intersection()symmetric_difference_update() and symmetric_difference()difference() and difference_update()Can you create a set like this: my_set = {1, 2, [3, 4]}?a={} What's the type of a?Can we add(list) to a set?pop(), remove() and discard()isdisjoint(), issubset(), and issuperset()time complexityOperators|, &, -, ^, </<=, >/>=, |=the difference between {'foo'} and set("foo")clear()intersection() and & operatordifference() and - operatorsymmetric_difference() and ^ operatorissubset(), <= and < operatorsissuperset(), >= and > operatorsupdate() and |= operatorcalculationssum/max/min/len/sorted/enumerateStringfunctionsclear, copy, fromkeys, get, itemskeys, pop, popitem, setdefault,update, valuecopy() and = operatorfromkey()get() and dict[key]items(), keys() and values()popitem()setdefault() and get()pop() and popitem()update()basic form"Hello World!""""Lorem ipsum dolor sit amet,consectetur adipiscing elit,sed do eiusmod tempor incididuntut labore et dolore magna aliqua."""propertyiterableconcatenate c = a + b and c=a*3FormatModify Stringsreplace()strip()split()sliced: t[start:end:step]upper(), lower() and swapcase()other methodscapitalize() and title()count, encode, find, index, join, zfill
1 / 2
567 6 3