http://www.cnblogs.com/onda/ ----------------------201,704,231: Cpython pypy difference, etc.; Cpython is a one-line explanation, PyPy is the whole file explanation two: Pycharm use: 1: Create project 2: Set character sets utf8 3: Set default Create file start #!/usr/bin/env python and UTF8 read 4: Modify Mouse wheel (Ctrl) to modify text size in setting search mous three: input and output: Inputs print Four: variables: 1: Letters, numbers (cannot start), underscores 2: cannot be a python default string 3: Conform to popular thinking, split five with underscore: Comment, single line # multiline ' ' Six: Format (indent): Pycharm is the tab (4 spaces) used. Seven: If judgment: If condition: expression elif conditions: &N Bsp expressions else: &N Bsp &nBsp expression eight: Loop 1: while expression: &nbs p; (Expression-->true Enter loop) expression &NB Sp Continue jump out of the loop break jump out of the loop 2 for i (loop body) in range (Ten) by loop body: &NBS P expression Nine: Data type: 1 integer int 2 Bohr bool 3 string str 10: Other: 1: Remove empty on edge White strip () lstrip () 2: Split Split (' delimiter ') default is space 3: Length len 4: Index strings and lists are ordered by a= ' AB ' a[0] print out "a" 5: Slices and indexes are similar, not only can you specify a location, you can also specify a section of a[0:2] 11: List A=[] convert strings to lists with list, whereas str#### #列表的方法A. Index (' value ') to find the position of the value a.append (' Value ') --> Append value a.count (' value ') --> count, number of a.extend (' list ') of a value --> Merge List A.index () --> View value location A.insert (position, ' value ') --> Insert A.pop () --> Delete last A.remove () --> Delete the specified a.reverse () --> Flip List a.sort () --> sort 12: Dictionary b={' key ': value} value can be dictionary, list, tuple etc a= (' A ', ' B ', ' C ') # # #方法只有俩个index Find location count number of units to find ########## #元组和列表 convert tuple (list) Turn list into tuple list (tuple) turn tuple into List 13: IO file Open: f=file (' 1.txt ', ' R ') F.read () F.close () write: W=file (' 1.txt ', ' W ')   ; W.write () W.close ()
Python lesson First day notes-la