```
class Solution(object):
def convert(self, s, numRows):
if numRows<=1:return s
trans=['' for i in range(numRows)]
j,incr=0,-1 #using incr to control list index increment in zigzag way
for i in s:
trans[j]+=i
if j==0 or j==numRows-1:incr*=-1 #alter the direction of inedx increment
j+=incr
temp=''
for j in trans:
temp+=j
return temp
```