[抄题]: Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of them. If there are less than 2k but greater than…
还是直接上程序吧,暂且就叫它为程序吧: ''' 按照多个分隔符分割,split的用法 ''' import re s='hi!chu?lan!heihei' re.split('[!?]',s) ''' 有汉字时候的分割 ''' str=u"[楚同学]小小同学_楚楚同学-春天来了" re.split(u'[|]|-|_', str) for i in re.split(u'[|]|-|_', str): print i ''' 按照一个分隔符分割时,split的用法 str.split…