The path to learning Python

Source: Internet
Author: User
Tags python script

Python interpreter:

CPython is most commonly used, but is slightly slower than other interpreters, but the user does not perceive

PyPy fast Speed interpreter

JythonJython is a python interpreter running on the Java platform that compiles python code directly to Java byte code execution. Infrequently, if you want to interact with the Java or . Net Platform, the best approach is not to use Jython or IronPython, instead of interacting with the network, to ensure the independence of each program.

Windows Configuration environment variable: (or when installing, tick add python variable also line)

"Right-click Computer"--"Properties"--"Advanced system Settings"--"advanced"--"Environment variable" --"In the second content box, find a row with the variable named Path , double -click The Python installation directory is appended to the variable value;

The Python script has to be executed

Windows:

650) this.width=650; "width=" 166 "height=" 265 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/> write the Python script with notepad++, drag the script directly into the shell in Windows, enter execution.

Linux:

definition interpreter: #! /usr/bin/env python

Python2 The ASCII code is used by default, Chinese is not supported, and if you want to display Chinese, you need to specify a character encoding set: -*-coding:utf-8-*-

650) this.width=650; "width=" 703 "height=" 108 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>

Python3 default use Utf-8, support Chinese

Print () string to use "", in addition to the defined variables or numbers

Print ("name") prints the name

Print (name) prints The variable value of name,

Print (*) Print the number 360

Print ("name", name) prints string and the Variable Value

Pycharm Use

Create Project ( project )---Direct ( catalog )----python file ( script files )

CTRL +? Bulk Comment or bulk cancel comment

If:

Elif:

Else

Must have a colon.

While:

else:

For I in:



Python First day script:

#后面得变量中需要用到前面变量值的时候, with the%s placeholder, three quotes are output in a newline format.
# name = "Zoudechao"
# age = 22
# job = "Linux"
# info = ""
#-----------Info of%s--------
# Name%s
# Age%s
# Job%s
#-----------End-------------"% (name,name,age,job)
# Print (info)

#用户输入并定义变量
# NAME = input ("Your Name:")
# age = Input ("Your Age:")
# job = input ("Your job:")
# info = ""
#-----------Info of%s--------
# Name%s
# Age%s
# Job%s
#-----------End-------------"% (name,name,age,job)
# Print (info)


# name = "Zoudechao"
# print ("Youy name:", name)


#输入4次数字, judging the score
# count = 0
# While Count <= 3:
# num = Int (input ("Your num:"))
# count + = 1
# if Num >= 90:
# Print ("Best")
# elif num >= 80:
# print ("good")
# elif Num >= 70:
# print ("OK")
# Else:
# print ("Gun")



#验证用户名和密码, exit correctly, try 3 times
# count = 1
# While Count <= 3:
# count + = 1
# NAME = input ("Your Name:")
# password = input ("Your password:")
# if Name = = "Zoudechao" and Password = = "zou12345":
# Print ("Welcome")
# Break
# elif Count = = 4:
# print ("error")
# Break
# Else:
# print ("Try")


#用FOR循环实现上题目标
# for I in range (3):
# NAME = input ("Your Name:")
# password = input ("Your password:")
# if Name = = "Zoudechao" and Password = = "zou12345":
# Print ("Welcome")
# Break
# elif i = = 2:
# Print ("Your error")
# Break
# Else:
# print ("error")




This article from "10936146" blog, declined reprint!

The path to learning Python

Related Article

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.