2024-05-13 23:24:48 发布
网友
a = [1, 2, 3] b = [a, b, c, d] c = ["why", "cant", "i", "make", "this", "work"]
期望输出:
a b c 1 a why 2 b cant 3 c I d make this work
您可以引用此代码
a = [1, 2, 3] b = ['a', 'b', 'c', 'd'] c = ["why", "cant", "i", "make", "this", "work"] def get_safenode(l, i): if i<len(l): an=l[i] else: an='' return str(an) maxlen = max(len(a), len(b), len(c)) print('%3s %3s %-5s' % ('a','b','c')) for i in range(maxlen): an = get_safenode(a, i) bn = get_safenode(b, i) cn = get_safenode(c, i) print('%3s %3s %-5s'%(an, bn, cn))
输出是这样的
a b c 1 a why 2 b cant 3 c i d make this work
您可以引用此代码
输出是这样的
相关问题 更多 >
编程相关推荐