Urllib is a Python-brought request library, a variety of functions compared to the relatively complete, Urllib library contains a few four modules:Urllib.request Request ModuleUrllib.error Exception Handling ModuleUrllib.parse URL Parsing
The sort () method in Python is used for array sorting, which is explained in detail in the example form:First, the basic formThe list has its own sort method, which lists the list in the original order, since it is the original sort, it is obvious
(Transferred from the website of Liao Xuefeng)function definitionIn Python, you define a function to use a def statement, write out the function name, parentheses, the arguments in parentheses, and a colon, and : then, in the indent block, write the
Linux version 4.9.0-4-686-pae This is the Linux system edition, my Side uses debian9.2 or 9.0来, should all be universal.More than one version of Python is installed by default in the system, with python2.7 being used by default, and now I'm learning
#!/usr/bin/env Python3#-*-coding:utf-8-*-#lists the file size and creation date and file name of the current directory, equivalent to the ls-l command fromDatetimeImportdatetimeImportospwd= Os.path.abspath ('.')Print('Size last Modified Name')Print('
Open (R ' C: \ ... ') when opening a filePlus R and no ' R ' are different' R ' is to prevent character escaping if ' \ t ' in the path does not add r, then \ t will be escaped and added ' R ' after ' \ t ' can retain the original appearanceThe
Crawler: A program that requests and obtains data from a target siteBasic Steps for Crawlers:Use Python's own Urllib library to request Baidu:Import= Urllib.request.urlopen ('http://www.baidu.com') Print(type (response))# Printing Results class'
Decorative Devicedefinition : Essentially a function, (decorating other functions) is adding additional functionality to other functions.principle : 1. Cannot modify the source code of the decorated function2. Cannot modify the calling mode of the
Directory
Directory
Code layout
Indent in
Maximum line width
Blank Line
Module Import
String
Spaces in expressions and statements
Comments
Naming rules
Programming
Pandas. DataFrame. rank,
DataFrame.rank(Axis = 0,Method = 'average',Numeric_only = None,Na_option = 'keep',Ascending = True,Pct = False)
Function: calculate the value data along the axis (1 to n ). The equivalent ranking is the average value of the
It's a little time at work. How can I use the fragmentation time to learn python,
It's a little time at work to use the fragment time to learn python.
One office computer:
Win7 64-bit Office System
Connect to the Intranet through
01Python basics _ 06 file read/write,
1. Read files
UseopenFunction orfileFunction to read the file, using the string of the file name as the input parameter
1 # Read File Content 2 3 f = open('test.txt ') 4 5 print (f. read () # read all file
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