将列表中的字符以‘*’连接生成一个新的字符串

#输出下面的字符

"""  1  2*3  

4*5*6  

7*8*9*10  

11*12*13*14*15  

16*17*18*19*20*21 """

x=1

n=int(raw_input('please input row number:'))

for i in range(0,n):  

x=x+i  

y=x+i  

#将列表中的每一个元素转换成字符  

m=map(str,range(x,y+1))  

#将列表中的字符以‘*’连接生成一个新的字符串  

print '*'.join(m)

原文地址:https://www.cnblogs.com/peachlht/p/5417434.html