Python basis Task 2

  1. List list
    ordered structure, index starting from 0, the data items do not have the same type

Create: list1 = [ 'a', 'b', 'c', 'd']
remove elements: del list1 [2]
length: len (list1)
maximum value: max (list1)
minimum value: min (list1)
end adding elements: list1.append (obj)
is inserted: list1.insert (index, obj)
removes the last element: list1.pop ()
reverse list: list1.reverse ()
Clear: list1.clear ()
copy: list1. copy () deep and shallow copy copy

  1. Tuple tuple
    element can not be modified, without brackets or parentheses, the element is only a comma

Create: tup1 = ( 'a', 'b', 'c', 'd')
deleted tuples: del tup1
length: len (tup1)
maximum value: max (tup1)
minimum value: min (tup1)

  1. String
    String Connection: +
    string Repeat: * number
    string interception: [start: end], does not include the end
    string formatting:% d integer,% s character
    multi-line character string: "" "" ""
    the ASCII , Unicode, UTF-8

Guess you like

Origin blog.csdn.net/madehuan/article/details/93515143