Set1.set is used to store a set of distinct key values, but does not store its value.There are two ways to create 2.set:
With the set function, the parameter is a list collection, for example: S=set ([1,2,3,4,5]);
The set literal
For lists, tuples, sets of similarities and differences, as explained below#list----> Allow duplicate collections, modify# tuple----> Allow duplicate collection, do not modify# set ----> Do not allow duplicate collectionsHere is the sample code:1S1
1. Follow the online tutorial step-by-step experiment, run the Times wrong:' Htmlresponse ' object has no attribute ' XPath ' in ScrapyThe personal use is scrapy0.14.4, the answer that the search obtains is Scrapy version is too low, so personal
The Python break statement, like in the C language, breaks the minimum enclosing for or while loop.The break statement terminates the Loop statement, that is, the loop condition does not have a false condition, or the sequence is not fully recursive,
The Ython continue statement jumps out of the loop, and break jumps out of the loop.The continue statement is used to tell Python to skip the remaining statements of the current loop, and then proceed to the next round of loops.The continue
Function:
To define a function:
def function (param1, param2 ...): bodyreturn XXX
function name in lowercase
Immediately exits when the return function is encountered
The default return value is NULL
"Set"set set, which is an unordered and non-repeating collection of elements1 #Create an empty collection2 ##s = set ()3 4 ##创建集合5 #s = {11,22,33,44}6 #print (s)7 8 ##add adding elements9 #s.add (' ab ')Ten #print (s) One # A ##clear Clear Elements -
1. What is a local variableA local variable is a variable that has a local effect and is defined inside a function. The scope is only within the function, the variables outside the function is not affected, that is, the same name function, if not in
# Practice: Finding differences# # The original in the databaseOld_dict = { "#1":8, "#2":4, "#4":2,}## new data reported by CMDBNew_dict = { "#1":4, "#2":4, "#3":2,}## need to delete:?Analysis# 1, the need to delete the data, that is, old_dict,
Haven't written similar code for a long time, feel good strange ...#!/usr/bin/python#Coding:utf-8ImportJSONImportgetoptImportSYSImportRequests#get command line argumentsdefget_opt ():Try: Config_opt= {"deploy_version":"None","file":"Jsonreport.json"}
CollectionCollection: The basic data type of Python is the combination of different elements to form a set.Collection elements: The members that make up the collection.>>> x = [11,22,33,11]>>> SE = set (x) >>> se{33, 11, 22}A collection object is a
Regular expressions are strings of characters and special symbols that are powerful tools for working with strings and can support multiple programming languages, so regular expressions are independent and useful, and worth learning, compared to
Python setup.py InstallThis step has been done, the first to doFollowing the method of adding environment variables as described earlier, we add the following path at the end:C:\Python34\Scripts;By now we are fully installed PIP:3, install NumPy
9. boolean type and Process Control of python, 9. Boolean Process of python
The boolean type is actually a special number. The following is the help information obtained by the help () function:Help on class bool in module _ builtin __: class bool
7. python string-built-in method analysis, 7. python string
In the previous article, the built-in methods of strings in python are listed and briefly described, but these methods are too many, and the efficiency is too low. I will summarize these
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