```
class Solution(object):
def summaryRanges(self, nums):
"""
:type nums: List[int]
:rtype: List[str]
"""
result = []
i = 0
while i < len(nums):
tmp = []
tmp.append(str(nums[i]))
while i < len(nums)-1 and nums[i+1] == nums[i] + 1:
i += 1
tmp.append(str(nums[i]))
i += 1
if tmp[0] != tmp[1]:
result.append("->".join(tmp))
else:
result.append(str(tmp[0]))
return result
```