def trans(num): if num // 10 == 0: return '%s'%num else: return trans(num//10)+'%s'%(num%10) a=trans(25969) print(a,type(a)) #25969 <class 'str'>