Learn a little every day, C # is tired of writing, recently in writing Node,python,swift, enrich their own development of the world;Python is more as a glue language, do some automated scripts, network tasks, database tasks, scheduled
Environment MySQL 5.5 python 2.6.6Download the package mysql-python-1.2.3c1.tar.gz and unzip it into the directoryModify the Mysql_config.path in setup_posix.py as the current MySQL profile path.By viewing the Readme executionPython setup.py
A simple example:Write the input to the created file:Import Osls= Os.linesep #Win is '\ r \ n'and Linux is '\ n'FileName= Raw_input ('Please enter your file name here:') whileTrue:ifos.path.exists (fileName): Print'the file "%s" has already existed'%
The existence of graphs to visualize data. No matter how complex things are, they are simple combinations.1 ImportMatplotlib.pyplot as Plt2 ImportNumPy as NP3Dict = {'A': 40,'B': 70,'C': 30,'D': 85}4 forI, keyinchEnumerate (dict):#circulate both
Today just finished writing SSH program, feel and write a QQ timely communication principle is similar, so the use of the afternoon time to modify the morning code, SSH inside there is a bug is when the client or the server does not enter the input
This article mainly describes how to use Python to read the JSON file and encode the content into JSON format, for the specific processing of JSON data is not described.#!/usr/bin/env python#-*-encoding:gbk-*-import string,timeimport jsonj_file=open
What is the case with parentheses (functions?) use the function to do what it wants to do with parentheses, to understand this function without?? ), under what circumstances without parentheses1, negative sign index and the length of the type simple
Import OS
Import Os.path
F=open ("Shouldlist.txt")
Shouldlist=[]
While 1:
Line =f.readline (). Strip (' \ n ')
# Print line
if not line:
Break
Shouldlist.append (line)
# Print Shouldlist
rootdir="Z:\GETOT_BW"
The following code is a few basic uses of numpy, including arrays and matrix operations ...1 ImportNumPy as NP2 Print ""3 Printnp.version.version4 Print ""5 PrintNp.array ([1, 2, 3, 4, 5])6 Print ""7 PrintNp.array ([[1,2],[3,4]])8 Print ""9
Transferred from: http://blog.csdn.net/menglin8908/article/details/16822171The python version built in ubuntu12.04 is 2.7.3 and recently wanted to update Python to 2.7.6. The update steps are as follows1. DownloadDownload the python2.7.6
Eventlet.backdoor is a pyhon interaction interpreter within a running process.The module makes it easy to detect the running state of a long running process and provides a Pyhon interaction interpreter that does not block the normal operation of the
Python Study Notes 1: Data Type, python Study NotesI. Python file type
1. Source Code
Hello. py:
1 #!/usr/bin/python2 print "hello world"
2. byte code: The python source file generated after compilation with the extension "pyc"
Compile method
Python with and without parameters decorator
For a decorator without parameters, the parameter of the decorator function is the name of the function object to be decorated;
The decorator with parameters uses the application parameters when calling.
[Python] Using Python for MySQL[Installation]
Install MySQL
You don't need to talk about installing MySQL. download and install MySQL without special attention.
One: Click to open the link[Example]
# Coding = utf-8import MySQLdb # number of queries
[Python] Non-ASCII character[Problem]
Html
It is found that Python does not support encoding in source files by default.
There are three solutions:
1. Add the following annotation code to the file header:
# Coding = for example, you can add #
Python getting started --- three methods of module import and Chinese commentsPython has three modules to import functions. 1. Using the import module import modname: a module is a code segment that can be used interactively or accessed from another
Python list counting and inserting instances, python counting instances
This example describes how to count and insert Python lists. Share it with you for your reference. The details are as follows:
Copy codeThe Code is as follows: word = ['A', 'B'
Chickens and rabbits in the same cage
Problem description
The chicken and rabbit are closed in a cage (the chicken has two feet and the rabbit has four feet, no exception ). I already know the total number of feet in the cage. I asked how many
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