Original address: http://www.omgdba.com/python-use-pypi-manage-packages.html
PyPI (Python pakkage index,http://pypi.python.org/pypi) is a Python public repository that manages Python-related brother feature packs. Anyone can log on to the home page
There is no dedicated SSH module in Python, which requires a manual installation module. The use of SSH in Python requires openssh, while OpenSSH relies on Paramiko modules, and Paramiko modules rely on Pycrypto modules, so to use SSH in Python, the
#-*-coding:utf-8-*-import mysql from MySQL import connector user = ' root ' pwd = ' 123456 ' host = ' 127.0.0.1 ' port = ' 3306 ' db = ' springmvc ' # money Transfer Class class TransferMoney (Object): # constructor def __init__ (self, conn):
The rename command under Windows can only replace a specific character in a file name with a string of the same length. The MV under Cygwin does not support batch renaming. So write one yourself. Originally prepare to use C, feel too troublesome,
#!/usr/bin/env python #-*-coding:utf-8-*-' Custom class ' __author__ = ' Hui.qian ' class Student (object): Def __init__ (sel F,name): Self.name = name s = Student (' Hui.qian ') s print S #添加__str__方法, equivalent to the ToString () class Student in
Here is a second design pattern in learning the simple design pattern: Observer mode
Define the Observer pattern first: The Observer pattern defines a one-to-many dependency between objects, so that when an object changes state, all its objects are
Look for work, and began to busy doing, for a long time did not update the blog, but the new online blog is too bad for the new interface, the classification of only two articles, each click to appear in a lot of other classes, every time to find a
Python source code must consist entirely of ASCII collections, and if you add a Chinese annotation directly to Python, the Python throws an exception when it executes, telling the non-ASCII character syntax error.
Similar: syntaxerror:non-ascii
In Python, in addition to being able to implement multithreading by inheriting the Threading.thread class, you can also invoke the Start_new_thread () function in the thread module to produce a new thread, as follows
Import time, Thread def timer ():
Elasticsearch is an open source search engine, built on the basis of a Full-text search engine library Apache lucene™. Lucene may be present, whether open source or private, with the most advanced, high-performance and full-featured search engine
Last semester to participate in a large data competition, need to crawl a lot of data, so I started from Sina Weibo, was ready to use Sina's API, but Sina did not open the keyword search API, so can only use crawler to get. Fortunately, Sina offers
1, No module named Win32API
Importerror:error Loading object ' Scrapy.core.downloader.handlers.s3.S3DownloadHandler ': No module named Win32API
Find the right Pywin32 installation---in this path http://sourceforge.net/projects/pywin32/files/pywin32
Cause: A few years ago in order to develop a monitoring system, need to periodically check the system state, so need to add to the inspection task, queued (by Time), remove and other operations, inadvertently found in the Java JDK Delayqueue, so
In Python more than 2.4 functions occasionally see the function definition of the previous line has @functionname modification, clatter this grammatical details, in fact, this is a bit like the C language with the parameters of the macro operation,
When writing a Chinese annotation in a python 2.X file or outputting Chinese, there is often a compilation error (no such error in Python 3.X). ):
Syntaxerror:non-ascii character ' \xe7 ' in file
This is installed to make it easier to use Python to manipulate hive.
Get Thrift,
Under the Linux command:
wget http://labs.renren.com/apache-mirror/thrift/0.8.0/thrift-0.8.0.tar.gz
TAR-XVF thrift-0.8.0.tar.gz
CD thrift-0.8.0
./configure
Make
sudo
Because Python differs from Java in the syntax of data type conversions, it is always confusing and is hereby documented for easy access:
In Python:
String str converts to Int:int_value = Int (str_value)
int converts to string str:str_value = str
Python3x, we can get the content of the Web page in two ways
Get address: National Geographic Chinese Network
url = ' http://www.ngchina.com.cn/travel/'
Urllib Library
1, guide warehousing
From Urllib Import Request
2, get the content of the Web
List.sort () method
This function method makes a forward sort of the list contents, the sorted new list overwrites the original list, and the sort sort method directly modifies the original listA = [5, 7, 6, 3, 4, 1, 2]A.sort ()Print aA.reverse () #
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