Python学习14:如何把Python代码写成一行?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python学习14:如何把Python代码写成一行?相关的知识,希望对你有一定的参考价值。

练习中有一个很无聊的问题:如何把Python代码写成一行?

print "How can i write python in a line? \n"; print "You can use ‘;‘ follow the sentence. " ; print "Then run the script!"; print; print "Done."

使用 ; 分割每段代码,就能把Python代码写成一行,但要注意语法。

以上是关于Python学习14:如何把Python代码写成一行?的主要内容,如果未能解决你的问题,请参考以下文章

Python中数据类型

如何在MATLAB中调用(运行)“用Python写成的函数或脚本”

Python装饰器详解

Python装饰器详解

Python 如何debug

Python自动化开发学习14