[Python]python Study Note (iii)--compiling

Source: Internet
Author: User
Tags glob python script

11, how to compile the compiled Python script for PYC format

[CPP]View Plaincopy
    1. #!/usr/bin/python
    2. Import Py_compile;
    3. Import SYS;
    4. File=raw_input ("Enter your file name");
    5. Py_compile.compile (file);
    6. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.