python随笔

Posted 凡心已炽

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python随笔相关的知识,希望对你有一定的参考价值。

1、输出不换行

import sys
sys.stdout.write("hello world!")

# 在 python 2.x 中使用 python 3 的print
from __future__ import print_function
print("hello world!", end="")

# ps. 这种写法并不是正确的,会在末尾多一个空格
print "hello world",

 

以上是关于python随笔的主要内容,如果未能解决你的问题,请参考以下文章