python3.x
#!/usr/bin/env python3
#coding: Utf-8 Year
= 1
years = 5
BJ = 10000 rate
= 0.05
f = open ("./source /interest.bak ", ' w+ ') while year
python2.x
#!/usr/bin/env python
#coding: Utf-8 Year
= 1
years =
BJ = 10000
rate = 0.05
f = open (
#-*-coding:utf-8-*-#写入数据的工具类 class FileManager (object): #保存文件名称 filename = ' student.txt ' #写一个写入数据的接口 @c Lassmethod def write (CLS, content, split = ' \ n '): ":p Aram Content: Data to be written:p Aram split: Each piece of data
To analyze who is the king of water stickers, the first to collect posts and posters of data. here to test Baidu Bar Liyi The first 100 pages:
#coding: Utf-8 import urllib2 from BS4 import beautifulsoup import CSV import re import sys reload (SYS)
class
The basic knowledge point record of a class
1. Old class and new type
-python's new class was introduced in 2.2, and the previous classes were called Old classes or classic classes. Before 2.2, classes and types were two different concepts,
This article reproduced from http://www.cnblogs.com/wuyuegb2312/archive/2013/04/09/3008320.html, and deleted some of the content
"Dahua design pattern" Python version of Code implementation
First, simple factory model
Model characteristics: The
previous: Own distorted understanding
Some time ago with the MATLAB feature, after all, I am small white, matlab is the easiest for me to program (although, Daniel's structure is very good, I can only waste time complexity, alas ~ ~ ~), but the
This module provides a few simple interfaces to compress and decompress files
Similar to the GNU Project's gzip and gunzip, data compression is derived from the support of the Zlib module.
Gzip.open (filename, mode= ' RB ', compresslevel=9,
As with the list,
List Inference TypeThe square brackets [] are also represented, and a shortened version of the For loop is used, the first part is an expression that generates the result list element, and the second part is a loop on an input
As a news crawler, the URL inside 0-9 of the date to the left plus 0. Two methods were obtained after the query.
First, set a large enough number, such as 1000000, and then add the current number such as 9, get 1000009, and then converted to a
The reload () function loads the previously imported modules again. Reloading (reload) includes the parsing process and initialization process that was applied when the module was originally imported. This allows the changed Python module to be
# # Record down the path of Python learning.
These days finally have time to take the Nova source to learn, but also right next to Python more proficient expert, nature more learning, ask more, summed up, hold on, get Nova.
In the process of
In Python, in addition to the list of lists, there is an ordered list called tuples: tuple, unlike list, tuple can not be modified once it is initialized, thus ensuring the security of the code to some extent.
As in the previous example, the
messages (message)
Message controls provide a way to display multiple lines of text, and you can set the font and background colorsExample:
From tkinter Import *
root=tk ()
root.title ("top") message
(root,text= ' Your can record your
1.1.the use of ideaPyCharm2017 DownloadLink: https://pan.baidu.com/s/1HPR9FtVV5BCvd3uTdOetxw Password: ok0qActivating IDEA2017
[Enter one of the following in server]:
Http://idea.liyang.io 1210 has been used,
http://idea.imsxm.com/
in-depth learning of classes
A. all things in Python are objects
B. class Foo:
Pass
obj = Foo ()
# obj is an object, Foo class
# Foo class is also an object, type objects
c. classes are objects of type class type (..
RequirementsIdeas:
The construction method passes the past school name and uses the UUID to create a random string that is used as the file name to write to
Using the __str__ method of the class to implement the Class object interface
The adorner is essentially a function, a function that decorates other functions. The adorner function takes the function name of the decorated function and returns the function name of the decorated function. There are two principles for decorating
Getting Started with Python crawlersI heard you wrote code without motivation? This article will give you the motivation to climb the sister map. If there's no motivation, then it's hopeless.GitHub Address:
Everything is possible---nothing is impossibleSummary: Input and output, conditions and loops, file operations, exceptions, modules and packages,python features, Linux basics and Git1 Basic Syntax:1: Input and output:1, modifying immutable data will
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