Input
>>>x=input (' Hint: ')
Output redirection
python2.7
>>>PRINT>>FP, "xxx" >>>fp.close ()
python3.5
>>>print (' xxx ', FILE=FP) >>>fp.close ()
A detail about for
>>>for I in range (3): Print (i) 012>>>for I in range (3): Print (i,end= ") 012 This means that Python's print function is the default At the end of \ n, when we use the For loop to print, pay attention to
Remark:1, programming takes precedence when using built-in functions to implement your own logical business
2. It is recommended to import only one module per import statement
Sequence
The reverse output is the last subscript-1, followed by 2,-3 ...
>>>a=[1,2,3]>>>b=a*3>>>b[1,2,3,1,2,3,1,2,3]
The slice operation does not throw an exception because the subscript is out of bounds, but simply truncates the tail of the list or returns an empty list, which is more robust.
>>>a=[1,2,3,4,5]>>>a[2:][3,4,5]>>>a[1,2,3,4,5]>>>a[:3][1,2,3]>>>a [1,2,3,4,5]>>>a[100:][] #返回一个空列表 >>>a[1,2,3,4,5]>>>a[:100:2][1,3,5] #在列表尾部截断 >> >a[1,2,3,4,5] #切片是浅复制, just assign values and not change the original list.
Things are too miscellaneous, are learning the time of 1.1 notes.
Python Learning notes Clutter two