python怎么输入空行_python列表中元素间插入空行

我写了一个手动输入后收集专辑信息的程序,写的很繁杂......是定义了一个可以将实参整理入字典的函数,再将字典放入列表

album_list = []

def album(name, singer, quantities_of_songs):

"""record the info of a album"""

info = {'name': a, 'singer': b, 'numbers ': c}

return info

while True:

a = input("input the name.\ninput 'q' to exit\n")

if a == 'q' :

b = c = 'q'

break

b = input("input the singer's name\n")

if b == 'q':

c = 'q'

break

c = input("input the number of songs\n")

if c == 'q':

break

recorded_album = album(a, b, c)

album_list.append(recorded_album)

question = input("do you have any other album?(yes/no)")

if question == 'no':

break

if a and b and c != 'q':

print("\n"*3)

print(album_list)

然而最后print出来的list是多个字典紧挨着排列在一起的,能否在每个元素之间插入空行使结构整洁一点

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值