Python [print function]

The following is one use of the print function, are separated by commas, you can print different types of data in the same row.
x = input ( 'Please enter dividend:')
Y = INPUT ( 'Please enter the divisor:')
Z = a float (X) / a float (Y)
Print (X, '/', Y, '=', Z )

#########################################################################################

>>> help (print) #python view of one of the ways to help

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

Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file: a file-like object (stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.

##############################################################################

print print Countdown

import time

print ( "Countdown Program")

for x in range(5,-1,-1):

  mystr = "countdown" + str (x) + "seconds"

  print(mystr,end = "")

  print ( "\ b" * (len (mystr) * 2), end = "", flush = True) # \ b backspace (len (mystr) print len ​​(mystr) Chinese character string of length 1 = 2 English characters (placeholder), so 2 *

  time.sleep(1)

 

Guess you like

Origin www.cnblogs.com/CH-TNT/p/11222565.html