打印每个输出一次:
f1=['part3_pl',
'part2_pl',
'part3_pl_to_p',
'part2_pl_to_p',
'part3_pl_to_p_lack',
'part2_pl_to_p_lack']
for i in f1:
for j in f1:
if i.endswith('pl') and j.endswith('pl_to_p'):
print(i,j,i+'_output')
返回值:
part3_pl part3_pl_to_p part3_pl_output
part3_pl part2_pl_to_p part3_pl_output
part2_pl part3_pl_to_p part2_pl_output
part2_pl part2_pl_to_p part2_pl_output
我想每行打印一次。
正确的输出:
part3_pl part3_pl_to_p part3_pl_output
part2_pl part2_pl_to_p part2_pl_output
慕虎7371278
相关分类