1. Data Type in Python.Nonetype, typetype (custom type), inttype, longtype, floattype, complextype (plural), stringtype, unicodetype, tupletype, listtype, dicttype, functiontype
Longtype has no length limit in Python, which is also an advantage of
In python, besides the threading. Thread class, you can call the start_new_thread () function in the thread module to generate a new thread.
Import time, thread def timer (): Print ('hello') def test (): for I in range (0, 10): thread.
Reprinted from: http://hi.baidu.com/myitlyj/blog/item/25586bd7088ba3dba044df6b.html using configuration files in Programs to flexibly configure some parameters is a very common thing, the parsing of configuration files is not complicated. This is
Module Installation
1. Single file moduleDirectly copy the file to $ python_dir/lib.2. Multi-file module with setup. pyPython setup. py install3. Egg file, similar to Java jar1) download ez_setup.py and run Python ez_setup2) easy_install *.
Scenario: on the port12345Enable file sharing.8000The port also accesses this share.
According to my previous articleArticle(Http://www.cnblogs.com/MikeZhang/archive/2012/02/11/httpFileSharePythonAndGo.html),
You can easily12345Enable sharing.
Exchange Element
The method for exchanging elements in python is very simpleProgramming LanguageUse temporary variables, but not in Python
>>> A = 1>>> B = 2>>> C = 3>>> A, B, C = C, B,>>>3>>> B2>>> C1>>>
Construct a dictionary
Python Random Number
Import random and find that there are a lot of randomize methods here. I will not repeat them here. You can refer to this document for self-study, including choice and shuffle, which are both highly integrated randomize
During this period of time, the server status is monitored.SNMPProtocol.SNMPInstallation configuration andPythonExtensionSNMPRecord it for later reference.
I. Installation
SNMP
1
,
Linux
Install
Net-snmp
Environment:Centos 6.3 _ 64
1
1. Install Python (such as 2.7), and install EXE directly in Windows2. Install django, download the tar.gz package, decompress the package, and run Setup. py.How to install Django under XP: http://avaj.javaeye.com/blog/2192123. Then you can follow
CodeAs follows:
I have not fully thought about it yet. Put it here and continue to develop ideas at the company.
# Coding: utf-8import sysimport osimport queueimport threadingfrom workerpool import workerpool, simplejobclass Manager (object): def
Copy From http://hi.baidu.com/chjj910/blog/item/7db5c24fbc699d19b2de0540.html
Python Programming Based on http: httplib, urllib, and urllib2 (for conversion)
Httplib implements the HTTP and HTTPS client protocols, which are generally not
In python, any type of objectBothYesTrue Value Test,True or false is returned.
The following values (regardless of the type) return false in the true value test:
1. None
2. False
3. Any type of numbers 0, including 0, 0.0, 0l, 0j
4. Empty
Python also has a logical branch key \. Like in MATLAB...
Input and Output
#! /Usr/bin/Python # Filename: using_file.py Poem = '' '\Programming is funWhen the work is doneIf you wanna make your work also fun:Use python!' '' F = file (
ThisProgramIt's relatively complicated. Let's look at the program first.
Def Info (object, spacing = 10, collapse = 1): "" print methods and Doc strings. takes modules, class, list, Dictionary, or string. "methodlist = [method for method in Dir
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