There are 3 ways to open a file: Read mode, write mode, append modeF=Open ( words ' , R ' ,encoding= Utf-8 ' ) #打开文件 Print(F.read ()) #读文件, after reading the file pointer to the last Print(F.readline ()) #读取一行内容 Print(F.readlines ())
1. Module Initial knowledgeThe power of Python is that he has a very rich and powerful library of standards and third-party libraries, and almost any feature you want to implement has the appropriate Python library support.Sys#!/usr/bin/env python#-*
Section content
Data type introduction and formatted output
STR type
STR index slicing and simple operation
First, data type introduction and formatted outputWhat is a data type:We humans can easily distinguish between numbers
There are basic 5 IO models in network programming, each model has its own characteristics but they are all designed to solve the problem of blocking during IO.1, blocking IO model (blocking)One of the most basic models, starting with learning
This article focuses on two methods of executing the shell in Python, two ways to execute shell programs in Python, one using Python's commands package, and two using the subprocess package. Both packages are Python's existing built-in modules. Need
The first step: Write Excel Operation methodexcel_operate.py file fromOpenpyxlImportLoad_workbook#Introducing ModulesclassMyexcel:def __init__(self,filepath,sheetname):#the initialization function is called when the object is instantiatedSELF.WB
In the Python function, you can also define mutable parameters.For example: Given a set of numbers a,b,c ..., please calculate a2 + b2 + C2 + ....To define this function, we must determine the input parameters. As the number of arguments is
Python consists of 5 standard data types:Numbers (digital)String (String)List (lists)Dictionary (dictionary)Tuple (tuple)There are list, Dictionary, and Tuple that belong to the collection data type.First, number (Numbers)Numeric data types are used
1 Data typesData types in Web pages can be divided into structured data , semi-structured data, unstructured data , three kinds of1.1 Structured dataThe common is MySQL, which behaves as a two-dimensional form of data1.2 Semi-structured datais a
# This is a learning note for the Liaoche teacher Python tutorial1. OverviewUrllib provides a series of functions for manipulating URLs.The urllib includes four modules, including
urllib.request " can be used to send the request and get
One, the codeThe Python interpreter encodes the content when it loads the code in the. py file (default Ascill)ASCII (American Standard Code for Information interchange, United States Standards Information Interchange Code) is a set of computer
# This is a learning note for the Liaoche teacher Python tutorial1 , overviewTCP is to establish a reliable connection, and both sides of the communication can send data in the form of a stream. The relative tcp,udp is a non-connection oriented
1.1 Implementing one-way linked list#The structure of the list is divided into 2 parts head,tail#(' A ', (' B ', (' C ', none) )#iteration Head was A;;;; tail is (' B ', (' C ', none))#Append time tail points to the last node (C, '
1. Request method sends get requests fromUrllibImportRequestImportJsonurl='Xxx/stu_info?stu_name=xiaohei'req=request.urlopen (URL,)#open a URL to send a GET requestContent=req.read (). Decode ()#Get return resultsRes_dic=json.loads (content)#return
# This is a learning note for the Liaoche teacher Python tutorialWhen multiple applications require different environments, virtualenv can be used to create a set of "isolated" python runtimes for each application1 , installation$ PIP3 Install
1. Basic data typesIntegral type--int; string--str; List--list; Ganso: tuple; Dictionary: Dict2. Basic Data Type Usage#整型i = the String a = "Nihao" #列表, List is ordered, so to access the list is obviously to be accessed by ordinal, like an array
This article mainly introduces the Python3 implementation of crawling JavaScript dynamically generated HTML Web page function, combined with instance form analysis Python3 use Selenium library for JavaScript dynamically generated HTML page elements
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