Static files management
Static files refer to files such as css, javascript, and images.
In the development phase:
1. Add 'django. contrib. staticfiles' in settings to set INSTALLED_APPS '.
2. Set STATIC_URL to '/static /'.
3. Place the static files
Many Internet companies may encounter multiple environments, such as testing, pre-release, and online, to isolate testing from the formal online environment. In this case, it is inevitable that the test link will be released to the production
Python has the basic function of reading and writing text files. The Python Standard Library provides richer read/write functions. The read and write operations on text files are mainly implemented by file objects built by open. Remember that the
Relationship fields)
ForeignKey, ManyToManyField, and OneToOneField define multiple-to-one, multiple-to-many, one-to-one relationships in the Model respectively.
For example, a book is published by a publishing house, and a publishing house can
A dictionary is a ing data type in Python. It works like associating an array or a hash table. It consists of key-value pairs. Almost all types of Python objects can be used as keys, but it is generally most commonly used as numbers or strings. The
We know that python is a scripting language with many advantages such as high development speed, but there are some differences in execution efficiency. How can we take into account the development speed and execution efficiency.In fact, Python can
1. Use the built-in method and modifier to obtain the class name and function name
In python, function names can be obtained from both internal and external sources. When the external conditions are good, the object pointing to the function is used
Example 1:
Python uses the WMI module to obtain the hardware information of the windowns system: hard disk partition, usage, memory size, CPU model, current running process, self-starting program and location, and system version.
Copy codeThe Code
What is SSL?
SSL is a popular encryption technology that protects users' privacy information transmitted over the Internet. After the website uses this encryption technology, a third party cannot read any communication information between you and
In this case, we wanted to outline all the passwords. The algorithms were either too deeply nested or especially memory-consuming (overflow). Later we chose an algorithm with a low probability of simple repetition. The Code is as follows:
Copy
Preface
Series of articles:[Portal]
That's why I met LC today.
Contents
Loop
For
While
Interrupted
Function
Function Definition
Function call
For Loop
The for loop in Python is like the foreach iteration in the shell script. In Python, for
Python Study Notes (2)
Process Control
If... else... elif
Example:
If 1> 2:
Print 'aaa'
-------------------------------
If 1> 2:
Print 'aaa'
Else:
Print 'bbbbbb'
----------------------
Enter the radius, calculate the circle perimeter, area, and sphere volume, and draw the circle.The data of the drag bar, input box, and image control is consistent!
Pass the test under Fedora
Copy codeThe Code is as follows:#
Count sorting
Assumptions: Each of n input elements is an integer between 0 and k, where k is an integer.
Basic Ideas: For each input element x, determine the number of elements smaller than x. With this information, you can directly put x into
Use re, urllib, and threading to capture the content of Tianya post, set the url to the first page of the Tianya post to be crawled, and set file_name to the downloaded file name.
Copy codeThe Code is as follows:# Coding: UTF-8
Import urllibImport
Asynchronous callback is required in many scenarios to avoid blocking. This is a simple example for your reference.Copy codeThe Code is as follows:#! /Usr/bin/env python#-*-Coding: UTF-8 -*-Import loggingImport queueImport threadingDef func_a (a, B )
Copy codeThe Code is as follows:# _ * _ Coding: UTF-8 _*_
# Xiaohei. python. seo. call. me :)# Win + python2.7.x
Id _ = 1F = open ('clubpop % s. xml' % id _, 'w ')For I, line in enumerate(open('suk.csv ')):If I % 50000 = 0:Print IF. write (' \ N \
The following code implements the ip address query functionHandlerCopy codeThe Code is as follows:Import OS, time
Def getip (filepath ):Ip2city = {}File = open (filepath, 'R ')Lines = file. readlines ()File. close ()For line in lines:Ip = line.
Base:
Created Monday 17 march2014
What is crawler?
Wiki explanation: http://en.wikipedia.org/wiki/Web_spider
By referencing the interpretation on WIKI, crawlers say that a program (nonsense...) is the first one. What can this program do? He can
Scrapy is based on version 0.20.2 (the latest version is 0.22.0) and python 2.7.6.
The development environment is windows 7 sp1.
Valuable references on the Internet
1. Scrapy getting started tutorial
The translation of documents on 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