第一行输出一个第二行输出两个以此类推
方法一:用while
a='abcd1234567890r'
hang=1
count=0
i=0
while i<len(a):
print(a[i],end='')
count+=1
if count==hang:
print()
count=0
hang+=1
i+=1
![在这里插入图片描述](https://img-blog.csdnimg.cn/2019022221462922.png)
方法二:用for
a='1234567891011121314151617181'
hang=1
count=0
for i in a:
print(i,end="")
count+=1
if count==hang:
print()
count=0
hang+=1
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190222214651185.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NDY3NTM3Nw==,size_16,color_FFFFFF,t_70)