Video address (all)
https://edu.csdn.net/course/detail/26057
Courseware address (all)
Video address (in this section)
https://edu.csdn.net/course/play/26057/321875
Course targets
• Python3 language built into the basic data types
type of data
• variable type C language
• C and Python language variable type comparison
Number Value Type
• Python3, only one integer type int
• Built-in type () function can query variables within the meaning of the object type
• You can also use the built-in isinstance () function to determine
the value • Python3 in True is 1, False values is 0
• only single-precision floating-point float, no double double
String (String)
• Python string three kinds of labeled
single quotation marks ( ') str =' this is string '
double quotes ( ") str =" this is string "
tris quotes (' '') str = ' ' 'this is string '' '
• string sections taken syntax:
variable [starting index: the subscript end: step]
• backslash escape special characters
• common string manipulation functions len (), replace (), index ( ), find (), split ( ) , etc.
List (list)
• List (list) is an ordered set, you can add and delete elements at any time
• element of the list may be different
• List also supports the interception slice syntax is as follows:
variable [starting subscript: subscript at the end: Stepping]
• List format [ "yh", "micheal" , "jack"], between [], comma-separated elements
• index value starting from 0, -1 end
• using (+) can be connected to two lists, (*) is repeat
Tuple (tuple)
• Tuple (tuple) and a list of similar, except that the elements of a tuple can not be changed
• tuple written in parentheses () where, between elements separated by commas
• tuple element types may be different
• The same list support sliced
• index values start at 0, -1 end
• If a tuple element has only one, then write (1), instead of writing (1)
Set (collection)
• the Set (set), is a disorder not repeat sequence elements
• braces {} may be used or a set () function creates a collection
Note: Create an empty set must be set () {} instead, because
{} is to create an empty dictionary
• Creating format:
{value1, value2, value3, value4, ....}
or
the sET (value)
• can be carried out between the collection: - set difference & intersection | ^ anti-union intersection
Dictionary (dictionary)
• dictionary (Dictionary) is a set of unordered objects, by elements of the key-value key to access
• a dictionary mapping type, a dictionary "{}" identifier, which is a random key (key) : value (value)
of the collection
• key (key) must be immutable type, the same dictionary keys (key) must be unique
• Additionally, dictionaries, there are some built-in functions, such as clear (), keys ( ), values () and so on.
• Dictionary to help us find and use the search function
Note:
Create an empty dictionary using {}
summary
• Number (digital)
• String (String)
• List (list)
• Tuple (tuple)
• Sets (collections)
• the Dictionary (dictionary)