python如何打印每个字符的空间

joa*_*oar 2 python

我在一个变量中有一个很大的数字,我想要的是每隔5个分离一个空格

码:

number = 123456789012345678901234567890
print "the number is:", number #Devide every 5'th 
Run Code Online (Sandbox Code Playgroud)

我想要的输出是:

The number is: 12345 67890 12345 67890 12345 67890
Run Code Online (Sandbox Code Playgroud)

ins*_*get 7

In [1]: number = 123456789012345678901234567890

In [2]: num = str(number)

In [3]: print ' '.join(num[i:i+5] for i in xrange(0,len(num),5))
12345 67890 12345 67890 12345 67890
Run Code Online (Sandbox Code Playgroud)