关于换行:一个小问题
问题:以下代码,如何换行?代码:
a=["1.Just do it","2.一切皆有可能","3.让程序改变世界","4.Nothing is impossible"]
b=['4.阿迪达斯','2.李宁','3.鱼C工作室','1.耐克']
c= for slogan in a for name in b if slogan == name]
print (c)
目前得结果:
['1.耐克:Just do it', '2.李宁:一切皆有可能', '3.鱼C工作室:让程序改变世界', '4.阿迪达斯:Nothing is impossible']
我期待得结果是:
'1.耐克:Just do it',
'2.李宁:一切皆有可能',
'3.鱼C工作室:让程序改变世界',
'4.阿迪达斯:Nothing is impossible'
提前感谢啦! a=["1.Just do it","2.一切皆有可能","3.让程序改变世界","4.Nothing is impossible"]
b=['4.阿迪达斯','2.李宁','3.鱼C工作室','1.耐克']
c= for slogan in a for name in b if slogan == name]
print ('\n'.join(c)) 厉害!这个join语句,我还没见过。
页:
[1]