Crawl novels of the novel website and save it to the databaseFirst step: Get the content of the novel first#!/usr/bin/python# -*- coding: utf-8 -*-import urllib2,redomain = '/HTTP Www.quanshu.net ' headers = { "user-agent": "mozilla/5.0
Python common exception types are roughly categorized as follows:1.AssertionError: Exception thrown when assert assertion condition is false2.AttributeError: Exception thrown when an object property that is accessed does not exist3.IndexError:
#! python# coding: utf-8# #创建一个疯狂填词 (mad libs) program, which reads into a text file and lets the user appear in the text file adjective, NOUN, adverb or verb and other words, plus their own text. For example, a text file might look like
#元组‘‘‘Tuples are immutable lists and cannot be changed.The same value as the list‘‘‘Tp= (a)tp1= (' 127.0.0.1 ', ' 3307 ')#元组只有count and index two methods.lis=[' 127.0.0.1 ', ' 8080 ']Tuple (LIS) #强制类型转换#字典, legends are important.#字典里的KYE不能重复info={'
According to the Official document explanation (Https://docs.python.org/3.5/library/platform.html#module-platform):The code for learning other people is as follows:#Python platform#Author:hongten#Mailto: [email protected]#Blog:http://www.cnblogs.com/
The Itertools module contains functions to create a valid iterator that can be used in various ways to iterate over the data, and the iterators returned by all functions in this module can be combined with a For loop statement and other functions
The time module was used in the recent exercise, so I learned about the time module in detail.Import time after help to see a detailed description of the time moduleYou can see that time has two representations:One, time stamp notationThat is, an
1. Defining stringsThe string has a subscript starting with 0, and [] can be used to remove the label2. String readingThe string can use loop for, one at a time to take out each element of the Loop object3. String modification-string not
Decorative Devicedef deco (count): def func (num): if num Note: The count in Deco (count) and the following count (Num) is just a formal parameter, and count can be replaced with any variable name, but Num must have it, so the passed
Matplotlib is a Python 2D drawing library that generates publishing quality-level graphics in a variety of hard-copy formats and cross-platform interactive environments.Bar chart#Coding:utf-8ImportMatplotlib.pyplot as PltImportNumPy as
A. zip function: Accepts any number of sequences (including 0 and 1) as parameters, returning a tuple list.1. Example 1:x = [1, 2, 3]y = [4, 5, 6]z = [7, 8, 9]xyz = Zip (x, y, z) print xyzThe result of the operation is:[(1, 4, 7), (2, 5, 8), (3, 6, 9
Object-Oriented ProgrammingObject-oriented programming is a programmatic approach that requires the use of "classes" and "objects" to implement:A class is a template, a template can contain multiple functions, function to implement some functions,
A tkinter:tkinter is a python-backed library of TK, and Python code calls the native GUI (TKL language development) provided by the Tkinter->tk-> operating system to complete the interface development without the need to install any third-party
Deque (maxlen=n) creates a fixed-length queue that automatically moves except for the oldest record when a new record is added and the queue is full. 1 from collections import deque 2 d=deque ( Maxlen=3) 3 d.append (1" 4 d.append (2 5
This article mainly introduces the Python 3 using BeautifulSoup Fetch P tag method, the text gives the detailed sample code for everyone to reference the study, to everyone has a certain reference learning value, needs of friends below to see
Shopping Cart SimulationDemand:
According to the user input and output corresponding to the backend
The server information can be added backend and
Sever information to delete backend and sever information
When you add server
Python common built-in modules-xml module (detailed description), pythonxml
Xml can be used to tag data and define data types. It is a source language that allows you to define your own markup language. The structure is similar to HTML hypertext
Day6 OS module, day6os
OS Module
Provides an interface for calling the operating system.
(1) OS. getcwd () obtains the current working directory, that is, the directory path of the current python script.
>>> OS. getcwd () obtains the directory path
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