```
def convert(self, s, numRows):
"""
:type s: str
:type numRows: int
:rtype: str
"""
if numRows == 1:
return s
period = numRows + numRows - 2
zigzags = [""] * numRows
for i in range(len(s)):
u = i % period
if u <= numRows - 1:
row = u
else:
row = period - u
zigzags[row] += s[i]
ret = ""
for i in range(len(zigzags)):
ret += zigzags[i]
return ret
```