Supplement to python-data types

Source: Internet
Author: User

 ' 
1.int
2.str
3. Meta-zu tuple
Tu = (' name ')
TU1 = (' name ',)
Print (Tu,type (TU))
Print (Tu1,type (TU1))
4. List
When you loop through a list, if you delete some or some elements in the loop, the number of elements in the list changes, causing the index to change and error-prone
5. Dictionary
When a loop dictionary is deleted, if you delete some or some key-value pairs in the loop, the number of key-value pairs in the dictionary changes. Changes in length, error prone
6. Convert
1.int-->str:str (int)
STR-int:int (STR) strings must all be made up of numbers
bool--and STR: The STR (BOOL) Boolean value is converted to the string
Str---bool:bool (str) except for the empty string, the remainder is ture, and the null string has a Boolean value of false
INT---Bool:bool ( int) In addition to 0, all that remains is ture,0 Boolean value of False
bool-to Int:ture-->1 false-->0
Str---list split
List-->str join
Str--> List:list (str)
STR--> tuple (GANSO): Tuple (str)
Tuple (Ganso)-S TR:STR (tuple)
Tuple (Ganso)--list:list (tuple)
List--and tuple (Ganso): Tuple (list)
0, ', {},[], (), set () the corresponding bool value is False

Tu = (all-in-a = list (TU)print= [4,2,6]print' Ab_c ' Print (list (s)) Print  = (1,2,3,4,5)print(str (a), type (str (a)), type (a))




Supplement to python-data types

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.