Security, access to the database is mostly limited, so there is a direct problem is that often, on other machines (such as their own local), is not able to access the database, to daily use caused great inconvenience. So a few days ago to do a
name = "My name is jiachen" #首字母大写print (Name.capitalize ()) #统计字母出现次数print ( Name.count (' a ')) #居中打印print (Name.center (+, '-')) #字符串装换成bytes类型print (Name.encode (' Utf-8 ')) # Judge with what end print (name.endswith (' en '))
#列表生成式list1 = [i*2 for i in range (1,11)] #生成器, the corresponding data list = is generated at the time of the call (x*2 for x in range (1,1000000)) #list. __next__ () #函数生成器def fib (max): n,a,b = 0,0,1 while n This article is from the
Project Structure Knowledge points
Create a project, write a __init__ file
Write setup.py and manifest.in files using the Setuptools module
To create a release version of a source file
Project Registration & Uploading to PyPI
Higher-order functions are called Higher-order function in English. What is a higher order function? We take the actual code as an example, step by step in-depth concept.Variables can point to functionsFor example, in Python's built-in function for
SOURCE http://www.educity.cn/wenda/354028.htmlPython path-related functionsOs.listdir (dirname): List directories and files under DirNameOS.GETCWD (): Get current working directoryOs.curdir: Returns the current directory ('. ')Os.chdir (dirname):
Python is a very popular language in the big Data world, with Python support built into the Linux terminal, and the CentOS Package management tool Yum is written by Python:
There are several versions of the Python interpreter, officially
Python Programming basic data types
None value
Integral type
Floating point Type
Boolean typeTrue,false
String
Tuple tuples(), ordered, not variableCases:t = (1,)t = (1, ' Hello ', 1.0,true)
Lists List[], ordered,
#设stime为字符串import timestime = "2011-09-28 10:00:00" #中间过程, it is generally necessary to convert a string into an array of time time.strptime (stime, '%y-%m-%d%h:%m:%s ') >>time.struct_time (tm_year=2011, tm_mon=9, tm_mday=27, tm_hour=10, tm_min=50,
Def partition (a, i, j): k = -1 while True: while k * (A[i] - a[j]) >= 0: if i == j: return i j += k a[i], a[j] = a[j], a[i] i, j, k = j, i - k, -kdef qsort (a, i , j): if
Python simulates browser login with Requests.session object cnblogsRequest. Session-to-row can be used to persist cookies across requests and is very handy for simulating logins.Cnblogs Login Page Analysis:Login Page
One, over 71 start =12 while start:3 if start!=7: 4 Print (start) 5 Start +=1View CodeWithin two or 100, and1 sum = 02 start = 13 while start:4 sum = Sum +start5 print(start,sum)6 start+=1View CodeThree, 100 inside odd
In learning the Python dictionary operation Method, feel SetDefault () method, more difficult to understand than the dictionary of the other basic methods of understanding more students, so think to summarize the following, this article mainly
This article mainly introduces in-depth analysis of Python timing killing process related data, the need for friends can refer to the following
Before writing a Python script to crawl new posts with SELENIUM+PHANTOMJS, in the process of looping the
The so-called recursion is actually the function itself that calls the function until a layer exits after the specified condition is met, for example
Once there was a mountain, there is a temple in the mountain, there is an old monk in the temple,
Closed Package
In Python, a function is also an object. Therefore, when defining a function, we can then nest the definition of a function and return the nested function, for example:
From math import Powdef make_pow (n): def inner_func (x):
This article is about Python's regular expression.
Nonsense not much to say, first start the simplest:
'. ': You can match any single character except the line break (that is, a point).
' * ' can match the preceding subexpression 0 or more times
Use Python to obtain nickname Based on Sina Weibo UID-simple crawlers and pythonuid
1 from bs4 import BeautifulSoup 2 import requests 3 from random import choice 4 import csv 5 6 headers1 = {'user-agent ': 'spider '} 7 headers2 = {'user-agent':
Python Day 2 -- operator, python Operator
I. Operators
1. Arithmetic Operation:
A divided by B a divided by c for division. Number after the decimal point
A // B is used for floor division. Only go to the integer, and remove the number after the
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