no return J) dic.clear () (Empty dictionary) del di C[B] (Delete key-value pairs with B as key)Tuple (tuple): t = (1,) (distinguishes between a tuple rather than a number) = (1'a', [1,2 ]) features: Immutable operation: query: dic[l:r] (return L to R-1 tuples) Dic.index (b) (subscript with return value B) Usage: = B, A (a B Exchange Assignment) (12) 23) ( Similar to dictionary order method comparison size)Set (SET):s = {1,} #
is the custom of naming in Python? I found that if the variable name was completely expanded, it would be too long-my MacBook Pro was too ugly to show up. This is followed by the variable shorthand naming of C + +.V. Entrance Call functionThe main function, similar to C + +. As soon as you run the knn.py script, the code is executed first:if __name__ = = ' __main__ ': print "You are running knn.py " CLASSIFYSAMPLEFILEBYKNN (' datingSetOne.txt '
=headers) Indexhtmlcode = Response.text Indexhtmlcode = Indexhtmlcode.encode (' utf-8 ') # Toulanbo y-http://www.cnblogs.com/toulanboy/# View the number of pages returned Pointregex = R ' points \s?=\s?
(\d*) Full code
Added logging and email alerts in the complete code for ease of maintenance
#!/usr/bin/python # coding=utf-8 # time: 2018-08-22 # toulanboy # reason: Want to implement auto play Npub
Exercise one: Hit all the even numbers between 1-100Def even_print (): For I in range (1,101): If I% 2 = = 0: print (i) even_print ()Exercise two: Design a function, create 10 files on the desktop, and name them as numbersDef text_creation (): path = ' c:/users/administrator/desktop ' for name in range (1,11): With open (path + str ( Name) + ' txt ', ' W ') as text: text.write (str (name)) text.close () print (' Done ') text_crea
least N fetches before \nm, then n is a backward reference followed by the literal m. If none of the preceding conditions are met, if both N and M are octal digits (0-7), then \nm will match the octal escape value nm.
\nml
If n is an octal number (0-3) and both M and L are octal digits (0-7), the octal escape value NML is matched.
\un
Match N, where N is a Unicode character represented by four hexadecimal digits. For example, \u00a9 matches the copyright sy
CBA this order put;"Group master" King (501562071) 2018/5/29 11:29:18Instead, you have advanced to the left, some advanced to the right of the parent class, the guiding principle is to ensure that the final "left-to-right", and the reverse derivation, according to the nature of the stack or queue should be how to go to that level of the parent class. Just that part; the inverse derivation of the final result is not complete: my phone 16:58:44Class B and C at around 11:40 in the 122 session are
):"""Flushes the current output of buffer to the network.the ' callback ' argument,ifGiven, can be used forFlow control:it would be run if all flushed data have been written to the socket. Note that only one flush callback can is outstanding at a time; ifAnother flush occurs before the previous flush'S Callbackhas been run, the previous callback would be discarded. .. Versionchanged::4.0Now returns a '. Future 'ifNo callback isgiven. """Chunk = b"". Join (Self._write_buffer) self._write_b
Sample of the data provided in the machine learning in action, which is said to be the characteristics of each candidate on a dating site, and how much the current person likes them. A total of 1k data, the first 900 as a training sample, the last 100 as a test sample.The data format is as follows:468933.5629760.445386didntlike81783.2304821.331698smalldoses557833.6125481.551911didntlike11480.0000000.332365smalldoses1 00623.9312990.487577smalldoses7412414.7523421.155160didntlike6660310.2618871.62
buttonDRIVER.FIND_ELEMENT_BY_ID ("download-btn"). Click () Four, chrome configuration#Coding:utf-8 fromSeleniumImportWebdriverprofile=Webdriver. Chromeoptions () prefs= {'profile.default_content_settings.popups': 0,#set to 0 to suppress pop-up windows 'download.default_directory':'d:\\'}#Specify the download pathProfile.add_experimental_option ('prefs', Prefs)#Executable_path This is the path to chromedriver. If the environment variable is set, this parameter can be omittedChromedriver_
Regular expressions
BeautifulSoup
Pyquery
Xpath
Select the appropriate parsing method, depending on the situation.Save data
Text SavePlain text, Json, XML, and so on.
relational database savingMySQL, Oracle, SQL Server, and more.
Non-relational database saveMongoDB, Redis, and other key-value forms of storage.
binary filesSpecific files such as pictures, videos, and audio.
Urllib LibraryPython built-in HTTP request library
Module
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.