Python Process Control

Python uses a colon: as the program block tag keyword.Note: Code within a block that is marked with a colon ': ' must have the same indentationIf/elif/else Judgment Statement[email protected] opt]# cat test.py#!/usr/bin/env python#--Coding:utf-8--If

Python XML module

#! /usr/bin/env python#-*-Coding:utf-8-*-Import XMLImport requestsFrom xml.etree import ElementTree as ET# 1. Reading an XML file as a stringpage = open (' Blog.xml ', ' R ', encoding= ' utf-8 '). Read ()root = et. XML (page)Print (root.tag) # tag

Read a Word document and extract and write data (based on Python 3.6)

#!/usr/bin/python3#-*-Coding:utf-8-*-# @File: Delete_file# @Author: Moucong# @Date: 2018/4/1 16:33# @Software: Pycharm#读取docx中的文本代码示例Import docxImport re#获取文档File=docx. Document ("E:\\python_word\\word.docx")Print ("Number of paragraphs:" +str (Len (

-socket Programming of Python development

I. C/S architectureC /S is the client/server mode, such as the browser is the client, a servers is the service side, the two for data interactionIi.OSI layer Seven  Application layer: The application that we useTransport layer: What you need to know

Python Learn the first day-user name login quit

First, use input to obtain the user name and user password, and then compare the obtained information with the information stored by the computer. If the information is correct, the user is welcome. Users have a total of three input opportunities,

Python Shopping Cart Program first practice

Product_list = [(' Iphone ', 8000),(' Mac Pro ', 9800),(' Bike ', 800),(' Watch ', 10600),(' Coffee ', 30),]Shopping_list = []Salary = input ("Input your Salary:")If Salary.isdigit ():salary = Int (salary)While True:For Index,item in Enumerate

Learning notes for classes in Python (source version)

1.1 First paragraph code#定义一个类(define a class )class Cat: #属性(attribution) #方法(methods) def eat(self): print("cat is eating a fish.") def drink(slef): print("cat is drinking milk.")

Python and Duck type

Tag: Apply it to the specified IKE classic interface iter Rri collectionPart of the reference source:jasonding https://www.jianshu.com/p/650485b78d11# #s1First, we introduce the following three features of object-oriented (OOP):(1) Object-oriented

python--005-function parameters, variables

• Parameters of the function·· Parameters1. Form parameter: parameter--form parameterParameters in parentheses when creating a function2. Actual parameter: argument--argumentArguments passed in parentheses when a function is called·· function

The first knowledge of Python module

The module getpass that is called when the password is hidden is previously spoken.The method of calling the module is import [Mod_name]Windows under the module of our system in its installation directory Lib directory.We write the module is

[3] Python: Using KNN to identify handwritten digits

The data is very important, the machine learning actual combat source code provides the data, this is very goodConvert the image into text, read into the vector, you can use the previously written classifier fromNumPyImport*Importoperator

Python basic "Data type"

Python Basics-Data typesPython data types include numeric types, strings, lists, tuples, dictionaries, and collections.1, int integer typeeg:1,2,3 .... Used for calculations, operations.#.bit_length () The least significant number of digits to

Python Study the third day

Basic data type 1. Digital Int2. String str#Str has too many function functions, so another document#Determine if it contains only characters or Chinese characters, and returns the Boolean typetest="HSADHKHBD"v=Test.isalpha ()Print(v)#v1 Determine

Python sends a message (the message received must be sent to the sender to reply)

rfc

Python uses SMTP (Simple Mail Transfer Protocol) to send plain text messages for ordinary text message delivery, the key is to set Mimetext _subtype to plain##-*-coding:utf-8-*-import Smtplibfrom email.mime.text Import mimetext# importing Mimetext

Python User Login module (methods such as not using functions)

* User Login ModuleGiven the user Information table, the following conditions need to be met:1. Enter user name password to judge2. Enter the number of errors 3 times, ask the user if you need to continue to try, y continue, N end3. Can support

A while loop in Python

1. The use of the Dead Circle Societya = 1while True: print(a) a +=12, unlimited input, until the loss of the right, only to exit_age = 18while True: guess_age = int(input("guess_age:")) if guess_age == _age: print("Good!!!!")

Python Series Reflection

First, static methods (Staticmethod) and class methods (Classmethod)Class method: There is a default parameter CLS, and can be called directly with the class name, you can interact with class properties (that is, you can use class properties)static

Python Learning Notes

Collection{} can represent a collection, {"As", "SST"} is a set set, and there are no duplicate elements in the collection.#add () adding elements to the collection girls = {' MF ', ' sl ', ' YJ '}girls.add (' XF ')#pop () randomly deletes an

Summarize the problem of Chinese coding in Python

This article to share the content is to summarize about Python in the Chinese coding problem, has a certain reference value, the need for friends can refer to How to deal with the problem of Chinese encoding Python unicodedecodeerror: ' UTF8 ' codec

How to manipulate excel in a Python environment

This article to share the content is how to operate in Python environment Excel, has a certain reference value, the need for friends can refer to One, the third-party library can be used Working with Excel tables in Python, common libraries include

Total Pages: 4013 1 .... 2024 2025 2026 2027 2028 .... 4013 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.