1. The first sentence of Python
Print ('helloWorld')
The file suffix name of the-python call can be any
-When importing a module, if it is not a. py file, an error will be
-It is recommended to always write the filename suffix as. py
2. Two modes of execution
1) Python interpreter py file path
2) Enter python into the interpreter for real-time input and get to the execution result (Interactive page)
3. Interpreter Path
# !/usr/bin/env python
4. Encoding
# -*-Coding:utf8-*-
Eg: in a Linux environment,
Filename:
./2.py
Inside the file:
# !/usr/bin/env python
#-*-Coding:utf8-*- % in Python3 this sentence does not need
Print ('helloWorld')
5. Perform an action
Prompt the user to enter a user name and password, if the user name and password are root, the login succeeds
#n is a variable, a variable can only consist of letters, numbers, underscores, cannot start with a number, cannot be named with a python keyword, and cannot be named with Python's built-in functions or classes#Using "" "" "in Python to annotate a programN1 = input ('Please enter user name:') N2= Input ('Please enter the password: ')ifN1 = ='Root' andN2 = ='Root':Print('Login successful ')Else:Print('Logon Failure') "" "Print(N1)Print(n2) "" "
Python Basics: Basics