簡體   English   中英

是否可以在不使用 Python 中的打印功能的情況下進行打印?

[英]Is it possible to print without using the print function in Python?

我想知道是否可以在沒有print功能的情況下在 Python 中打印(例如字符串)。 這可以通過命令或一些技巧來完成。

例如,在 C 中有printfputs

有人可以告訴我打印或否認這種可能性的方法嗎?

sys.stdout.write("hello world\n")
import sys
sys.stdout.write("hello")

您可以使用

sys.stdout.write()

有時我發現sys.stdout.write比將許多內容打印到一行的print更方便,因為我發現用於抑制換行符的print結尾逗號語法不方便。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM