Test platform Ubuntu 13.04 x86_64 Python 2.7.4
Spent nearly two hours, the problem is mainly at the beginning did not expect to pass a file object into the thread, resulting in downloaded files and source files MD5 different, waste a lot of time.
Linux system uses Python to get CPU information script sharing
Copy Code code as follows:
#!/usr/bin/env Python
From __future__ import print_function
From collections Import Ordereddict
Import Pprint
Def CPUinfo ():"" Return the
net.py get input and output of network interface
Copy Code code as follows:
#!/usr/bin/env Python
Import time
Import Sys
If Len (SYS.ARGV) > 1:INTERFACE = sys.argv[1]ElseINTERFACE = ' eth0 'STATS = []print ' Interface: ',
For example
Copy Code code as follows:
Director 汤姆·提克威 / Lana Vodoski / Andy Vodoski
screenwriter Tom Tikwi / Andy Vodoski / Lana Vodoski
starring Tom Hanks / Halle Berry / Jim Braudbent / Hugo Uighur / Jim Stergis / Pei
Linux server has CentOS, fedora and so on, all pre-installed Python, version ranging from 2.4 to 2.5, and Windows type of server is mostly installed Python, so as long as the local write a script, upload to the corresponding machine, at run time
Copy Code code as follows:
#!/usr/bin/python
#coding: Utf-8
#write: JACK
#info: FTP Example
Import ftplib, socket, OS
From time to import sleep, CTime
def loginftp (self):FTPs = Ftplib. FTP ()Ftps.connect
Log files are usually generated by day, then replace the monitored log files by judging the file's date of production and the current time in the programThe program is just a simple example, monitor test1.log 10 seconds, turn to monitor Test2.log
The three-mesh operator is the ternary operator
The ternary expressions of some languages (such as Java) are as follows:
A result when a condition is true: the result of a false decision
Result=x if X
Python's ternary expression has the
After saving as a. py file, run the script to add the process name later. For example: Python proinfo.py QQ can get information on the process of QQ, note that the case is not case-sensitive
Copy Code code as follows:
#-*-Encoding:utf-8
One, Java endFirst I use the Java WebService Support package to write the server and the release program, the code is as follows.WebService Interface Code:
Copy Code code as follows:
Package com.xxx.test.ws;
Import
Environment: "Wind2003[open Tftp Server] + VIRTUALBOX:UBUNTN10 Server"Tftp:open TFTP ServerUbuntnPython + pyexpectVirtual machine Reason: Pyexpect does not support windows
Note: Originally intended to use SECRUECRT script, because the practice
is a simple python query Baidu keyword ranking function, here are some brief introduction:1, UA Random2, simple and convenient operation, direct GetRank (key words, domain name) can be3, code conversion. There should be no problem with coding.4, the
Recently took over more and more things, the release and operation of the work is quite mechanical, coupled with the frequency is quite high, resulting in time wasting or more advantages. Fix bugs, test, submit version library (2 minutes), SSH to
1. Ways to take the past specific time:
Copy Code code as follows:
#!/usr/bin/python
Import time#取一天前的当前具体时间Time.strftime ('%y-%m-%d%T ', Time.localtime (Time.time () -24*60*60))
#取15天前的当前具体时间Time.strftime ('%y-%m-%d%T ',
1. Notepad can set-preferences-language-tab to spaces2. Editor recommended Sublime3. Data type:3.1 If there are many characters in the string that need to be escaped, you need to add a lot \ , in order to simplify, Python also allows r‘‘ ‘‘ the
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