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