The use of __name__ in Python

These days began to learn python, encountered some problems, but also solved some problems.where if __name__ = = ' __main__ ': This sentence estimates a lot of beginners like me are superficial understanding.Here's an explanation:1:__NAME__ is a

Python string: Part 1

ord

Python string: Part 1----String: A collection of ordered characters1, single and double quote strings are the same, single quotes embedded in double quotation marks or double quotation marks embedded in single quotation marks, single quotation marks

01 Knapsack problem (Dynamic programming) Python implementation

In the 01 knapsack problem, choose whether to add an item to the backpack. It is necessary to compare the solution of the sub-problem of the item with the solution of the sub-problem of the item, which leads to a lot of overlapping sub-problems,

Python, serialization

Serialization:Variable from memory into a process that can be stored or transferredCalled pickling in Python, also called serialization,marshalling,flattening in other languages, etc.Deserialization (unpickling):Variable contents re-read from

Python generates two-dimensional code images

Rely on the Pillow library.ImportQRCode#Simple Usageimg = Qrcode.make ('Hello world!') Img.save ('Qr_code.png')#Advanced UsageQR =QRCode. QRCode (#Two-dimensional code matrix sizeVersion=1, #Two-dimensional code fault tolerance

Python factor decomposition

Before using Python to solve the problem, let's say, what is the factor decompositionThe so-called factor decomposition is the first to find the number of all the approximate (approximate: A%b = = 0, that is, a can be divisible by B)For example: 20

Python output string, multiple lines, numbers, spaces

Python can output text using print, and several text outputs are described below Pure string Use single or double quotation marks: single and double quotes with no difference, but pair: print "Hi friend!"

Python formatting operators

Formatting Operators• Strings can use formatting symbols to represent special meanings%c convert into characters%s Priority str () function for string conversion%d/%i turn into a signed decimal number%o Turn unsigned octal number%e/%e turn into

Python del function

Usage:-------del for list operation, delete one or more successive elements.# define a list>>> a = [1,2,3,4] >>> a[1,2,3,4] >>> del a[0] # delete No. 0 element >>> a[2,3,4]>>> del a[ 1:3] # Removes the element starting from the 1th element to the

Python (1)

1. Interpretive, object-oriented, high-level programming language with dynamic semantics.2. Using Python650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/9A/0C/wKiom1lQtDWQolC9AAB7rPG2HCM173.png "title=" ULT0) 3x{yh3wo$z~d$~]1ko.png "alt="

Shenzhen ai +python why hot?

Python The birth is very early, but the real hot time is not long. At present , the Python language is widely used in the field of system programming, graphics processing, mathematical processing, Text processing, database programming, network

Python Gets the memory information of Linux

Python Gets the memory information of Linux1. Install Psutil Source codeHttps://pypi.python.org/pypi?:action=display&name=psutil#downloadsFind psutil-5.2.2.tar.gz Click to download Shell # tar XZVF psutil-5.2.2.tar.gzShell # CD psutil-5.2.2Shell #

Installation Example Tutorial for PYTHON3+BEAUTIFULSOUP4

Extracting the contents of a Web page with regular expressions is rather cumbersome, and here is a Python library that extracts data from an HTML or XML file: Beautiful Soup. It allows you to navigate your favorite documents, find them, and modify

Pip change Domestic Source instance detailed

Linux Environment: You can use the mirror source directly, plus-I specify the address: 1 sudo pip install-i module name If a non-trusted error occurs: You need to add the command after the 1 sudo pip install-i --trusted-host

Python list parsing

List parsing, primarily for dynamically creating lists This article focuses on the use of the combination of lambda, map (), and filter () with the list parsing statements The basic syntax for list parsing is: [Expr for Iter_var in iterable] At the

A detailed introduction to python3.x

Machine learning Combat This book is written in python2.x environment, and python3.x many functions and 2.x in the name or use the same way, so the original book content needs to be corrected, the following is a simple record of the process of the

Python day1, day1

Python day1, day1 Python is an interpreted language. Python 2 or 3 options: Python 2.7 is the latest version of 2 and the last version. The update support will be stopped by 2020, but companies that are currently using or have completed development

Python crawler practice: 2017 ranking of the best universities in China, python7 7

Python crawler practice: 2017 ranking of the best universities in China, python7 7 Capture content: Capture the top 10 university rankings, university names, and total scores from the best universities in China, and align the data in the

Python coding minutes, python minutes

Python coding minutes, python minutes 1. map, filter, reduce1) map (func, input_list)Apply the function to each element in the input list, for example:Input_list = [1, 2, 3, 4, 5] Def pow_elem (x ):"""Perform multiplication operations on x: Param x::

Install Beautifulsoup and beautifulsoup

Install Beautifulsoup and beautifulsoup1. Obtain the Tag1.find _ all method (1) find_all (name = 'tag _ name', attrs, recursive, text, ** kwargs) Name: The name corresponding to the tag. When multiple tags are included, a list is returned. You can

Total Pages: 4013 1 .... 2941 2942 2943 2944 2945 .... 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.