for x in range(1,11): for y in range(1,11): print(x*y)
![偷笑](http://static.blog.csdn.net/xheditor/xheditor_emot/default/titter.gif)
![偷笑](http://static.blog.csdn.net/xheditor/xheditor_emot/default/titter.gif)
![偷笑](http://static.blog.csdn.net/xheditor/xheditor_emot/default/titter.gif)
![偷笑](http://static.blog.csdn.net/xheditor/xheditor_emot/default/titter.gif)
str_list=[] for x in range(1,11): for y in range(1,11): str_list.append('%d'%(x*y)) str_list.append('\t') str_string="".join(str_list) print(str_string) str_list=[]
运行结果:
=================开挂模式呢?==============================
暂时还没想出来。
=================乘法口诀表放入文件中===============================
with open('乘法口诀表.txt','w') as f: f.writelines("1\t2\t3\t4\t5\t6\t7\t8\t9\n") f.writelines("-"*70+'\n') str_list=[] for x in range(1,10): for y in range(1,10): str_list.append('%d'%(x*y)) str_list.append('\t') str_string="".join(str_list) str_string=str_string+'\n' f.writelines(str_string) str_list=[]
实验结果: