Is it possible to print without using the print function in Python?
问题 I wondered whether it is possible to print (for example a string) in Python without the print function. This can be done by a command or by some trick. For example, in C there are printf and puts . Can someone show me a way to print or to deny this possibility? 回答1: sys.stdout.write("hello world\n") 回答2: import sys sys.stdout.write("hello") 回答3: You can use sys.stdout.write() Sometimes I find sys.stdout.write more convenient than print for printing many things to a single line, as I find the