python

2.Python_0: Hello!

2020-07-14  本文已影响0人  MissLady的学习志

****学 习 地 址 :****

计算机科学圈| 01000011 01010011 01000011

https://cscircles.cemc.uwaterloo.ca/


1. 输出函数print( )

语法(Syntax):

print(object(s), sep=separator, end=end, file=file, flush=flush)

参数(Parameter Values):

Parameter Description
object(s) Any object, and as many as you like. Will be converted to string before printed
sep='separator ' Optional. Specify how to separate the objects, if there is more than one. Default is ' '
end='end ' Optional. Specify what to print at the end. Default is '\n' (line feed)
file Optional. An object with a write method. Default is sys.stdout
flush Optional. A Boolean, specifying if the output is flushed (True) or buffered (False). Default is False

object(s) -- 表示输出的对象。输出多个对象时,需要用 , (逗号)分隔。

sep='separator ' -- 可选,用来间隔多个对象,默认' '。

end='end '-- 可选,用来设定以什么结尾,默认值是换行符 \n。

file -- 可选,要写入的文件对象,默认sys.stdout。

flush-- 可选,布尔值,指定输出是刷新(真)还是缓冲(假),默认缓冲。

2. Coding Exercise & Answer

写一个程序,打印出:Bonjour, tout le monde!

参考:

[1] https://cscircles.cemc.uwaterloo.ca/

[2] https://www.w3schools.com/python/ref_func_print.asp

上一篇 下一篇

猜你喜欢

热点阅读