y The tool is to use : Recommended IDLE, There are two ways , There are interaction mode and editor mode .IDLE It is more suitable for students who are just beginning to study .
Python Three points to check when an error occurs :1. Check whether the punctuation mark is a punctuation mark in English .2. Check that the indent is correct , Indenting spaces will affect the correctness of the code .3. Check that the function is spelled correctly .
Use of several shortcut keys :Alt+p You can cut to the previous code ,Ctrl+c End of the said
Variables and strings :
Python Variables do not need to be defined , Direct assignment can represent variables , for example :x = 3 There is no need to add a semicolon , Very convenient ,Python The interchange of two numbers is very simple ,C The language borrows the third variable , and Python Unwanted , direct x, y = y, x When writing assignments , In order to write beautifully , General variables 、 Space 、 be equal to 、 Space 、 The number . You can also add a space after the comma .
character string : Single quotation marks ' ' Double quotes " " Three quotes ''' ''' , Quotation marks are in English , And they all appear in pairs .
The escape character is in the case of multiple single quotation marks and double quotation marks , In order to make Python Know that this is a simple quotation mark , When there is no other special meaning , Escape characters with backslashes \ Express ..\\ Indicates a simple backslash ,\' Indicates a simple single quotation mark ,\n Means line break ,\r Said the enter , There are still a lot of it , Can read .