Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有以下 ascii 十六进制字符串“4a65737573”。我现在如何迭代它,包装固定数量的字符,但始终以 2 递增。即 4a65、6573、7375...
这应该这样做:
In [218]: mystr = "4a65737573" In [219]: for i in range(0, len(mystr), 2): .....: print mystr[i:i+4] .....: 4a65 6573 7375 7573 73