Lovely Python sorting
Python-weak data type, no mandatory declaration required
Python-everything is an object
Pyhton-statement block ends with: And the next sentence is indented.
Python-reuse level code lines → functions → classes → modules
Python-functions supported
Python-KISS Principle = Keep it simple, stupid
I. Chinese support
#-*-Coding: UTF-8 -*-
Ii. Use modules
Import OS, sys, cmd
Fromt sp_tools. py import *
From threading import thread # Multithreading
Iii. Modules
OS. listdir ('path ');
OS. Walk ('path ')
File Operations
Open ('filename', 'A/W'). Write ('content ');
Iv. Functions
Def method (param1, param2 ):
Dosomething
V. Command Line Interaction
Import sys
SYS. Arg [x]
Vi. Category
Class classname (CMD. cmd ):
Def _ init _ (Self ):
Cmd. cmd. _ init _ (Self)
If _ name _ = '_ main __':
Dosomething
Thread
Class grepit (thread ):
Def _ init _ (self, param1, param2 ):
Thread. _ init _ (Self)
VII. Syntax
Filelist = OS. listdir ('path ')
For CDC in filelist:
If ". CDC" in CDC:
If keword in line:
Print line
Exception capture
Try:
For type in tryuni:
Try:
Ustring = Unicode ("% s}" % Type + stream, type)
# Try decode by list
Except t:
Continue
# Break! Continue try Decode guess
Except t:
Return U "Bad Unicode encode! "
8. Other Tools
Chardet encoding Detection
Epydoc py document Builder
Configparser file operation API
Web Framework
Karrigell webframeworks
Web. py
9. Others
Desktop development tk/tcl qt wxpython win32com