python learning (data type)

Basic data types
(1) numbers digital
  • % D int int

 

  • Long integer Long
  • Boolean boor
    •   True False
  • % F float type
    •   3.1415926 4.2E-10
  • Complex complex
    •   6.23 + 1.5j -1.23-987j
(2)% s string str
name1 = 'zhengying'
print type(name1)

(3) the tuple (tuple)

  • definition:
    •   Variable is connected behind the ()
    •   Brackets empty, then an empty tuple
    •   When there is only one element in brackets, is not tuple string str
    •   To achieve only one element tuple in parentheses, you need to add a comma behind the element ""
  • Features:
    •   Tuples can not modify / delete / insert elements Operation

 

(4) List (list)

  • definition:
    •   Variable is connected behind the []
    •   Whether in [] is empty or only a single / multiple values, are a listing
  • Features:
    •   Support for the list to modify / delete / insert elements operating


(5) Dictionary (dict)

  • definition:
    •   Variable is connected behind {}
    •   When the {} is null, null Dictionary
    •   The key-value dictionary of the format, such as brackets { "key1": "value1", "key2": "value2"}
  • Features:
    •   Support for the dictionary to modify / delete / insert elements operating


(6) a collection (set)

  • definition:
    •   Contact is {} after the variable, but not key parentheses to the format, but the string

Guess you like

Origin www.cnblogs.com/Mr-ZY/p/11716151.html