classSolution:defconvert(self,s:str,numRows:int) ->str:if numRows >=len(s)or numRows ==1:return s step =1 index =0 res = [''] * numRowsfor i, v inenumerate(s):# cur_line is not index res[index]+= vif index == numRows-1: step =-1elif index ==0: step =1 index += stepreturn''.join(res)