标签:移位 -o logs elf shift span pre 代码 log
要求:
>>> a = Nstr(" l love china ") >>> a >> 6 ‘china l love ‘ >>> a << 3 ‘love china l ‘
代码:
class Nstr(str): def __lshift__(self , other): return self[other:] + self[:other] def __rshift__(self , other): return self[-other:] + self[:-other]
标签:移位 -o logs elf shift span pre 代码 log
原文地址:http://www.cnblogs.com/marianyad/p/6690698.html