一.字符串的表示和存储 字符串是字符的序列,每个字符都有有一个数字作为标识,同时会有一个将标识转换为存储字节的编码方案: s = 'hello world python' for c in s: print(c, end=' ') h e l l o w o r l d p y t h o n ACSII为协议内的每个字符分别对应一个数字,然后以这个数字的二进制形式存储到计算机; s = 'hello world python' for c in s: num = ord(c) print(nu…
vector预分配内存溢出导致原始的 迭代器 失效 consider what happens when you add the one additional object that causes the vector to reallocate storage and move it elsewhere. The iterator’s pointer is now pointing off into nowhere: This illustrates the concept of iterat…
#coding=utf- from struct import pack,unpack byte=pack('f',1.5) print(byte) print([i for i in byte]) byte=pack('f',123432.523424) print(byte) print([i for i in byte]) 输出 b'\x00\x00\xc0?' [, , , ] b'C\x14\xf1G' [, , , ]…