Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- max_digit = 10 # 最大桁数(intなら10桁)
- dic = ['0','1','2','3','4','5','6','7','8','9']
- def itoa(num):
- result = ''
- previous = 0
- for i in range(max_digit,-1,-1):
- temp = num / (10**i)
- if temp > 0:
- result += dic[temp - previous *10]
- previous = temp
- return result
- if __name__ == '__main__':
- print itoa(102340)
Add Comment
Please, Sign In to add comment