capitalize ()Change the first character of a string to uppercasestr1 = ' Xiaoxie 'Str1.capitalize ()→xiaoxiecasefold () change all characters of the entire string to lowercase>>> str1 = ' Assdfaweadfaajjilooommkl '>>> Str1.casefold ()'
1 #basic logic blocks for exception handling2 #is as follows:3 #Exception refers to all errors that can catch all errors4 #valueerror Indexerror ... It's a subclass of exception.5 #www.cnblogs.com/wupeiqi/articles/5017742.html sums up a number of
ZatanBefore using the requests module climbed the beautiful picture, today with the scrapy framework to achieve it again.(Picture scale is really big point, but Swaiiow already have no love red dust, right when watch haha ha)Item:# -*-coding:utf-8-*-
Use global variables in functions (declared with global):>>> x = 1>>> def change_global (): Global xx = x+1>>> change_global () >>> x2A local variable in a function has the same name as a global variable, and 2 uses the same case (gets the value of
Python parameter BasicsPosition parameters? Match by position, pass parameter value to parameter name of function head, order from left to rightKeyword parameters? Use the variable name of the parameter when calling, using the form of
NumPy Introduction:The numpy system is an open-source numerical extension of Python. This tool can be used to store and manipulate large matrices, which is much more efficient than Python's own nested list (nested list structure) structure, which is
Some time ago I want to use Python to write a screenshot of the translation of small functions, so the first need to get the mouse coordinate action is pressed, dragged, released. Find a lot of informationIt is pyhook or rewritten in other languages.
Underlying data type 1, numberint: (integer)2. Boolean valueTrue or False 1 or 0#None,"", (), [], {}, 0 ===> are False3. String
"Hello World"
String Common methods:. Capitalize () #首字母大写# to center a string by adding a padding character (
Python Code Note points:1. Note Indent2.if, while and other statements remember to add a colon:3. Note the use of spaces4. When writing code through PYCHARM, note the prompt informationData:goods = [{"Name": "Computer", "Price": 1999},{"Name":
Import geventdef foo (): print ("Running in foo") Gevent.sleep (2) print ("Explicit context switch to Foo again ") def Bar (): print (" Explicit context to Bar ") gevent.sleep (1) print (" Implicit context switch back to bar ") Def
Practice content: Use two ways to implement dictionary access attribution: Use a class wrapper dictionary so that the dictionary does not use [] to access the element, use the. Dot number to access the element as if it were a property.Mode one:
ImportRequestsImportRe#get hush values and albumIDdefGethush ():Globalmusicname Musicname= Input ('Please enter the name of the song you want to download:') URL='Http://songsearch.kugou.com/song_search_v2?callback=jQuery1910026785707623246724_1490845
Requirements: You can choose to go to each submenu from any level back to the previous layer you can exit the program from any level required new knowledge points: List, dictionaryMenu = {' Beijing ': {' Haidian ': {' Five crossing ': {' Soho ': {},'
EXEC descriptionEXEC executes python statements stored in a string or file, and can execute more complex Python code than eval,exec.return valueThe exec return value is always None.It should be explained that exec is not a function in Python2, but a
The path to learning in Python -2018/6/26
1.ORM Single-table operation delete and modify records>>> ret = Book.objects.filter(title="go").delete()(1, {‘app01.Book‘: 1})>>> Book.objects.filter(price=115).update(price=120)Multiple table operations
1 ImportRequests2 fromlxmlImportetree3 fromBs4ImportBeautifulSoup4 ImportOS5 fromSeleniumImportWebdriver6 7 8 9 #parse each comic page and download comicsTen defmanhua (URL): One A - browser.get (URL) - the #get the page source of the
Basic data types for Python3
Variables do not need to be declared in advance
Each variable must be assigned before it can be created after assignment.
In Python, a variable is of no type, and the word "type" here refers to the type
First, the premiseIn the previous article, I wrote the download Excel2003 blog post, here to download Excel2007 blog post for three reasons:First, the Excel2003 basically has been eliminatedSecond, Excel2003 download file is too large, not conducive
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