5. Three mesh operators, C-language arrays, linked lists and Python strings, List of links

Source: Internet
Author: User

Tag: replace array int array to implement connection span Python request ternary operation

1. Three mesh operation, ternary operation

If L==1:name = "Alex" Else:name = "Eric" name = "Alex" if L==1 Esle "Eric" Print (name)

  


2.c connection to Python


STR, the function of a string is usually to generate a new string (parenthesis, replace, etc.)
List, the function of a dictionary is generally modified in them
What is this for?

Li = [11, 22]
If the list is stored continuously in the address, then we have to insert, modify the need to reserve space beforehand, then how much to stay, this is a problem. So the list in Python is similar to the link in C instead of the array. So it's also understandable, because the string in Python is implemented by a character array in C. So at the time of the modification, only the new memory can be applied, that is, a new string is created, even if a letter is replaced, a new string is generated, and the original string is still preserved. Therefore, in Python for str, is a one-time creation, can not be modified, can only be modified and then created, and for List, the equivalent of linked list, can be arbitrarily inserted, modified, deleted. But if each element in our list is a string, and when one of the strings is modified, a new string is created, and the original index number is concatenated with the new string in the form of a linked table, and the original string is still in memory

5. Three mesh operators, C-language arrays, linked lists and Python strings, List of links

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.