Python3----How to easily understand if __name__ = = ' __main__ ' in Python

1. SummaryPopular Understanding __name__ == ‘__main__‘ : If you call Xiaoming, in the eyes of friends, you are Xiao Ming (__name__ == ‘小明‘) ; in your own eyes, you are yourself (__name__ == ‘__main__‘) .if __name__ == ‘__main__‘The code block below

3-python Common Modules

System Information-psutil Import Psutil,datetime#cpuprint ("Cpu_times:\t", Psutil.cpu_percent (), "\ n") #内存mem = Psutil.virtual_memory () print (" Mem_total:\t ", int (mem.total/1024/1024)," MB ") print (" Mem_free:\t ", int (mem.free/1024/1024

Python Jobs-Multilevel menu

Practice Python Multi-level menu reading function, is actually the list or the dictionary of ITER Functional Requirements: Run the program output first level menu Select a Level menu item, output Level Two menu, the same output

Python---The use of ORM in Django (4) field, parameters (On_delete focus) Supplement

1. Index:Normal index: Speed up searchUnique index: Speed up lookup, unique constraintsPrimary KEY index: Speed up lookup, unique index, not empty class UserInfo (models. Model): username = models. Charfield ( null =false, #不允许为空 db_column = '

Python---The form component in Django (validation using custom methods before data is added, and source analysis)

Form Component code: fromapp02.models Import User fromdjango.core.exceptions Import ValidationErrorclassAjaxform (forms. Form): User=Fields . Charfield (Required=True, Min_length=3, Max_length=7,) email=Fields . Emailfield (Required=True,) #自定义方法

Python Full stack learning--day11 (function advanced application)

One, what is the function name?Function names are the names of functions, Nature: variables, special variables.Function name () Execute this functionWhen the function is executed (called): Break. * An Iterative object (Str,tuple,list,dict (key))

DAY01: My path to Python

1. What's the language of Python? Python is a dynamic, explanatory, strongly typed, defined language.(1) Dynamic language and static language① static language: The language in which data type checking is done during compilation, such as C,c++.②

The OS module in Python

The Python OS module provides a unified operating system interface function One, for the operation of the system 1, Os.name is currently using the platform where ' NT ' is windows, ' POSIX ' is a specific path delimiter for Linux or unix2, OS.SEP

Python----Object-oriented---custom exception types

Object-Oriented---custom exception types1 classmyexception (baseexception):2 def __init__(Self, msg):3Super (MyException, self).__init__()4Self.msg =msg5 6 def __str__(self):7 return ''%self.msg8 9 Ten RaiseMyException ('my own type

Win10+python encountered: Using TensorFlow backend. Error

error Description: Using tensorflow backend.I. Installing Microsoft Visual C + + redistributable Update 3First in https://www.microsoft.com/en-us/download/details.aspx?id=53587.Download Microsoft Visual C + + redistributable Update 3.and then

python--Decorator

Why should I have an adorner?Open closure principle: Closed to modification, open to expansionWhat is an adorner?Adorners are callable functions, which are also functions that can be called by decorators.Principle: Do not modify the code of the

python-recursive functions, nested functions

Recursive functions:Inside a function, you can call other functions. If a function calls itself internally, the function is a recursive function.Cases:def Calc (n): Print (n) if int (N/2) = =0 :return n return calc (int (n/2))

First, Bo Master Python basic Summary---to perfect version---Follow-up has been released

Basic data types for Python:1. Variable: List dictionary2, immutable: integer string ancestorString: "or" "# String abbreviated to STRList: [] #listGanso: () #tupleDictionary: {} #dictIntegral type: Digital #intCollection: #setsBoolean type: Correct

Python Learning Note 2-string manipulation

One, string slices# slices can also fit into the string tittle=' today's hair apple ' for in Enumerate (tittle): # enumerate can loop subscript and value at the same time Print ('%s:%s' % (i,t))Second, non-empty is true# non-empty is true Print

Python container, iterator, generator

1. Containers, iterative objects, iterators, generator concepts1. Container: A data structure that stores many elements. Usually stored in memory (iterators, generators are special cases) can use in to determine whether an element exists in the

"Cute Python" reading notes (vii)

gpg

no best, only more reasonable!Use the default list printing format to store and report the fact that it is not a very well, thinking about modifying the changes, so:# -*- coding: utf-8 -*-import osdef cdwalker (Cdrom, cdcfile):     export =  ""

Pseudo-private properties of Python

Pseudo-Private propertiesThe variable __x defined in class Example automatically becomes _example__x, and the variable with double underscore before the variable is called a pseudo-private property, why is it called a pseudo-private attribute?

Python Basic Tutorial Project five virtual Tea Party

This article mainly for you in detail the Python Basic Tutorial project Five virtual Tea Party, with a certain reference value, interested in small partners can refer to Almost every time you learn or use any programming language, there is never a

Python List of Functions & methods detailed

This article is mainly to share with you the Python list of functions & methods in detail, I hope to help everyone. Python list Functions & methods Python contains the following functions: Serial Number function 1 CMP

Python basics 7: python Basics

Python basics 7: python BasicsI. Data Type Supplement 1. str #1. casefold # usage: S. casefold () # meaning: the lower () method is only ASCII encoded, that is, 'a-Z', effective for other languages (non-Chinese or English) can only use the casefold (

Total Pages: 4013 1 .... 1174 1175 1176 1177 1178 .... 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.