Writing scripts in Python under a Linux system certainly does not prevent various directories and folders. For easy reference in the future, simply summarize the directory and folder-related operations in Python. The module that needs to implement
This period of time to do things more messy, part of the time in doing operations, part of the time in the development, always too anxious, always feel a lot of things do not very satisfied. Still want to calm down to think carefully, spend more
#法一import Ospath = "c://python34//" for file in Os.listdir (path): if Os.path.isfile (Os.path.join (path,file)) ==true : if File.find ('. ') Python batch renames two methods of files under a specified folder
Three ways to import a function
From math import sqrt #import the SQRT function is e.g. sqrt from math import * #import all functions from M Ath module e.g sqrt import math #import math Module,and use the function via math.* e.g. MATH.SQRT (25 )
XLRD is a module designed to read Microsoft Execel in Python and can be installed either directly or through the Package manager. Component's official website address: http://www.python-excel.org/Basic operation:#-*-encoding:utf-8-*-#设置编码方式import
Python's set is similar to other languages and is an unordered set of distinct elements, with basic functionality including relationship testing and de-duplication elements. The collection object also supports mathematical operations such as Union
Use of the module: Import the module via import and use the module's function in the format "module. function".Such as:>>> import math>>> math.floor(32.9)If you do not want the module name to be written every time the function is called, you can use
Python's automatic interception is especially simple (note: Python version is 2.7 ... )First install the PIL module, this module go here (http://www.pythonware.com/products/pil/) to find your version corresponding to the PIL installation
Python's default GUI toolset is Tk, which can be used with the Python interface Tkinter to use TK,TK not the strongest up-to-date, nor the toolset that contains the most GUI building blocks, but it is very simple, And you can develop GUI programs
Lambda expressions in Python
Lambda expressions are often used in Python. Here we summarize the common methods of Lambda expressions.
First, you must understand that Lambda expressions exist in Python as an anonymous function constructor. Secondly,
Python multi-level sorting (multi-attribute sorting) csv file
Multi-level or multi-attribute sorting is often used when processing csv files. You can use the following method to easily perform multi-level sorting.
Python 2.x uses the following
Python Entry 1-use of functions to release and install programsPython Entry 1-use of functions to release and install Python
This article is intended for those who have some programming experience and have at least one programming language.
Most of
Python uses opencv for face detection and tracking, and pythonopencv
In the pattern recognition class, the teacher left an experiment and used OpenCV library programming in the VC ++ environment to implement face detection and tracking.
Then we
Use virtualenv in CentOS to build the python3 environment, centospython3
Problem description
Environment: CentOS6.5
To use python3 for development in this environment, the default python environment for CentOS6.5 is 2.6.6.
Previously, python3 was
Python converts string to uppercase and lowercase, and python to uppercase and lowercase.
Judge string
S. isalnum () # All characters are numbers or letters. isalpha () # All characters are letters s. isdigit () # All characters are numbers.
Right-click the Python file and find the IDLE option. solution,
It is often encountered that double-click the. py file to run, or right-click the file without an IDLE edit item, which is common in WIN7.Double-click the *. py file to run it.
Six tips to help you improve Python Running Efficiency
People who do not like Python often vomit that Python is too slow to run. However, this is not the case. Try the following six tips to speed up your Python application.
Tip 1: use external
Python File Read and Write method summary,
This example summarizes the methods for reading and writing Python files. Share it with you for your reference. The specific analysis is as follows:
1. open
After opening a file using open, remember to call
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