String introduction
1. Storage of strings in memory;
2. String addition;
3. Formatting of strings;
In [1]: a = 100 In [2]: a Out[ 2]: 100 #100<255, occupies one byte in heap memory, one byte is 8 bits, and the maximum value that can be stored is 255. In [3]: b = "100" In [4]: b Out[ 4]: ' 100 ' #corresponds to ASCII code storage, one byte stores any one character, so the string 100 corresponds to 3 characters and occupies 3 bytes. Strings take up a lot of space. In [5]: type(a) Out[5]: int In [6]: type(b) Out[6]: str
In [4]: b = '100' In [7]: c = "200" In [8]: b + c Out[8]: '100200'