crtrl.py python script to monitor the Apache server process
Copy Code code as follows:
!/usr/bin/env Python
Import OS, sys, time
While True:Time.sleep (4)Tryret = Os.popen (' ps-c apache-o pid,cmd '). ReadLines ()If Len (ret) Print
I sometimes write a program to use the current time, I want to use Python to take the current time, although not difficult, but always forget, with one lost,In order to be able to better remember, I deliberately write down the way to get the current
Like the following XML file:
Copy Code code as follows:
1
2
Here are some of the ways Python parses XML files, implemented using Python modules.
Mode 1,python module implementation to automatically
Program execution requires reading two files Command.txt and ipandpass.txt. The format is as follows:
Copy Code code as follows:
Command.txt:
Threadnum:1
Port:22
Local_dir:hello_mkdir
Remote_dir:hello_mkdir
Recently downloaded a lot of various tutorials, unfortunately, the suffix name is ". mp4", and I Like ". rmvb" suffix, because of a slight cleanliness, can not stand the ". mp4" suffix, but manual modification is too cumbersome, so use the recently
Catching seeds through urllib2 and re modules
Ideas
1. Use the program login forum (if you need to login to access the section)
2. Visit the designated forum
3. Traverse the post (first take the specified page, and then traverse the URL of all
First, subprocess and the commonly used encapsulation functionsWhen we run Python, we're both creating and running a process. Like the Linux process, a process can fork a subprocess and let the child process exec another program. In Python, we fork
Enter the radius, calculate the circumference, area, sphere volume of the circle, and draw the circle.Drag bars, input boxes, and image controls to keep the data consistent!
Fedora under test through
Copy Code code as follows:
#https://
Written using Python + shell, is a simple Solaris system patrol procedure
Copy Code code as follows:
#!/usr/bin/python-u
#-*-Coding:utf-8-*-
'''
Program: solaris_status.py
author:gyh9711
Function:
System State Information
Python's most concise and understandable scan port code. It would be amazing to run.
Copy Code code as follows:
From threading import Thread, Activecount
Import socket
Import OS
def test_port (Dst,port):
Os.system (' title '
Operating system: LinuxSoftware Environment: Python 2.7.3
Usage:
Copy Code code as follows:
$./monsocket.py
# This is check the URI or Socket of the script #
Usage:
./monsocket.py-d URL; This is Http protocol
./monsocket.py-s
Python uses the cTYPES module to invoke the Windows API GetVersionEx get the current system version without using the Python32
Copy Code code as follows:
#!c:/python27/python.exe
#-*-Coding:utf-8-*-
"To determine the current system
The idea of sqlalchemy is that the scale and performance of SQL databases are important to the collection of objects, while the abstraction of object collections is important for tables and rows.One installation SQLAlchemy
Copy Code code as
Copy Code code as follows:
#!/usr/bin/env python
Import Sys,time
From socket import socket
def read_interface (in_file):
With file (In_file) as F:
return F.readlines () [2:]
def set_interface (inter_msg):
dic={}
For i in Xrange (Len
Data has changed in the previous section from the zero-learning Python series of data-processing programming instances (i), in addition to the student's results, the document added the student name and the date of birth, so it will become: according
Copy Code code as follows:
# OS ModuleOS.SEP can replace the operating system-specific path separator. Windows is ' \ \ '
The Os.name string indicates the platform you are using. For example, for Windows, it is ' NT ', and for Linux/unix
The sample code for sending the message is as follows: fromWebutilsImportProperitiesload fromEmail.mime.textImportMimetext fromEmail.mime.multipartImportMimemultipartImportSmtplibImportOSclasssendmails ():" "to send a message with an attachment, you
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