1. print () and input (), 1. printinput

Source: Internet
Author: User

1. print () and input (), 1. printinput

Hello world (required)-print function

Print (): function:

Print function, print data to the screen

Parameter List:
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
Parameter description:
Value,..., indicates that there can be multiple data to be printed, such as print ("a", "B", "c ")
Sep indicates the parameters between the printed data.
"End" indicates the end character to be printed. For example, "\ n" indicates that the line break is printed, and "\ t" indicates that the line break is indented to the next position.
File indicates the output stream, sys. stdout indicates the standard output stream, and sys. stderr indicates the standard error stream.
Flush indicates whether to refresh the buffer immediately
Usage:
print("hello world!")print(1,2,3,sep='\t')print('a','b','c',sep='#')print(1,end='\t')print(2)

Output result:

hello world!1    2    3a#b#c1    2

 

Input (): function:

Input Function to obtain user input

Parameter List:

Input ("input prompt information ")

Usage:
Name = input ("Your name:") age = input ("your age :")

Output result:

 

To use the non-plaintext mode, use getpass in the getpass module:

(This module cannot be used normally in pycharm ))

Usage:

Import getpasspwd = getpass. getpass ("enter the password :")

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.