The python print() function uses

describe

  • print() is used to print output, a function in python3.x, and a keyword in Python.

grammar

print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)

parameter

  • objects – plural, indicating that multiple objects can be output at one time. When outputting multiple objects, they need to be separated by ','.
  • sep – used to separate multiple objects, the default value is a space.
  • end – used to set what to end with. The default newline character \n, we can replace it with other strings.
  • file – The file object to write.
  • flush – Whether the output is cached depends on file, but if the keyword argument is True, the stream will be forced to be flushed.

return value

none.

example

print(1)

1

print("Hello World")

Hello World

a = 1
b = 'fw is me'
print(a,b)

1 fw is me

print(''aaa'' ''bbb'')

aaabbb

print("aaa","bbb")

aaa bbb

print("www","taobao","com",sep = ".") # 设置间隔符

www.taobao.com

Guess you like

Origin blog.csdn.net/w2190623446/article/details/128689441