11, how to compile the compiled Python script for PYC format
[CPP]View Plaincopy
- #!/usr/bin/python
- Import Py_compile;
- Import SYS;
- File=raw_input ("Enter your file name");
- Py_compile.compile (file);
- Sys.exit ();
12,python's Glob module ~
The Glob module is a python-brought module that you can use to find file path names and files that match a specific rule. Only three matches are used to find a file: "", "?", "[]". "" matches 0 or more characters; "?" Match a single character; "[]" matches a character in a specified range
>>> import glob#调用glob()方法>>> glob.glob(r‘c:\*.txt‘)[‘c:\\log_client.txt‘, ‘c:\\test.txt‘] #返回一个列表>>> glob.glob(‘*.txt‘)[‘LICENSE.txt‘, ‘NEWS.txt‘, ‘README.txt‘] #返回当前目录下的txt文件,不包括文件路径
13,python how to get the current time
Click to open link
>>> time.strftime ("%y-%m-%d%x", Time.localtime ())
' 2011-05-05 16:37:06 '
[Python]python Study Note (iii)--compiling