The implementation code is as follows:#!/usr/bin/python#*-*coding:utf8*-*from optparse import optionparserimport osimport sys# use option Help information can be used in Chinese reload (SYS) sys.setdefaultencoding ("Utf-8") #定义选项以及命令使用帮助信息usage
First, indentThe compiler or interpreter is responsible for translating the syntax-compliant program code into the machine code that the CPU can execute, and then executing.The # statement at the beginning is a comment, and the comment is visible
The first is the installation of the dual version anaconda:The python2.7 version was previously installed, and the installation of TensorFlow only supported version 3.5. But his original version of the 2.7 did not want to abandon. So install the
Function:The __import__ () function is used to dynamically load classes and functions. Returns a list of tuples.If a module changes frequently, it can be dynamically loaded using __import__ ().__import__ Syntax:__import__ (name[, globals[, locals[,
One, Dict (Dictionary) typeDict (Chinese dictionary) is another variable container model and can store any type of object.Each key value of the dictionary (key=>value) pairs with a colon (:) split, each pair is separated by a comma (,), and the
Encapsulation: Public properties and methods are encapsulated in a class, and objects encapsulate the value of a private property classF1:def __init__(self,n): self. N=NPrint('F') classF2:def __init__(SELF,ARG1): SELF.A=arg1Print('F2')
1 >>> my_dict = { " i ": 1," fuck ": 2," you ' : 3} 2 >>> my_dict 3 { " i " : 1, " fuck " : 2, " you : 3} 1 Import Pandas as PD 2 PD. Series (my_dict)3 fuck 24 i 15 you 3Dtype:int64A dictionary with only one value for
Identifier
The first character must be a letter or underscore ' _ '.
The other parts can be letters, numbers, and underscores.
Identifiers are case sensitive.
Built-in keywordsThey cannot be used as any identifier name.
First, the data typeIn Python, there are several types of data that can be processed directly:1, Integer2. Floating point number3. String ' or double quotation marks " any text enclosed, such as ' abc ' , " XYZ " , and so on.
Recently, taking advantage of the vacation, reviewed the previous learning of Python knowledge, and research new web framework bottle, wrote a simple login page, detailed can refer to the official document http://bottle.zzir.cn/No nonsense, directly
This article mainly introduced the Python prime number detection method, the example analyzes the Python prime number detection correlation skill, needs the friend to refer to,
specific as follows:
Factor Detection:
Detection factor, Time
This example realizes the search results of grasping the "java" keyword in netease cloud classroom, and the result of the request is post in detail, and the results are JSON Data.The specific implementation code is as
Python uses pip to update all installed packages.
The newer pip supports list -- outdated, so record the new method:
Pip list -- outdated -- format = legacy | awk '{print $1}' | xargs sudo-H pip install-Upip3 list -- outdated -- format = legacy |
Django verification code generation and use example, django verification code example
Preface
This article mainly introduces the Django verification code generation and use. We will share the content for your reference and learning. Let's take a
Python tips: Sorting list items, python list items
This article describes the sorting of Python list items for your reference. Let's take a look at the details below:
Typical code 1:
data_list = [6, 9, 1, 3, 0, 10, 100, -100] data_list.sort()
In Python, metadata groups, lists, Dictionary differences, and python dictionaries
Python has three built-in data structures: List, tuples, and dictionary.
1. List
List is the data structure that processes a group of ordered projects. You can store
Python uses PyCrypto to implement the AES encryption function example, pycryptoaes
This example describes how Python uses PyCrypto to implement AES encryption. We will share this with you for your reference. The details are as
The python bottle framework supports the RESTful PUT and DELETE methods of jquery ajax, and jqueryrestful
In the past two days, the backend Management System was developed using the python bottle framework. The interface agreed to use RESTful
Python-implemented simple dns query function example, pythondns query example
This example describes the simple dns query function implemented by Python. We will share this with you for your reference. The details are as follows:
#!
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