':'201200131012',Ten 'pwd':'23342321' One }) A #URL of the login educational system -Loginurl ='Http://jwxt.sdu.edu.cn:7890/pls/wwwbks/bks_login2.login' - #impersonate the login and save the cookie to the variable theresult =Opener.open (loginurl,postdata) - #Save cookies to Cookie.txt -Cookie.save (Ignore_discard=true, ignore_expires=True) - #use cookies to request access to another URL, which is the score search URL +Gradeurl ='Http://jwxt.sdu.edu.cn:7890/pls/wwwbks/bkscjcx
is 4, 3.14 obtained is 3"Math.PI can get pi valuePow (2,4) 2 of the four-time squareSQRT (81) Open SquarePrecision processing of floating-point typeUnder normal circumstances, you should get 0, but you get a different value. This is the problem of precision.The decimal module solves this problem of precision, which provides a decimal class, which takes into the form of a string when passing a valueAnother way to importThe nature of BoolBOOL only true
QQ space Python crawler (3) --- final chapter, python Crawler
After testing, the code in the previous section is successfully run, and the next step is to add loop crawling to get all the instructions -. -
Complete code:
1 import requests 2 import json 3 import OS 4 import shutil 5 import time
value is constant.Python provides partial support for functional programming. Because Python allows the use of variables, Python is not a purely functional programming language.First, the definitionSimply put, "functional programming" is a "programming paradigm" (programming paradigm), which is how to write a program's methodology.The main idea is to write the operation process as much as possible into a s
. such as "hao123", just enter "ao123" can also be located toElement positioning: Find_element_by_xpath ()1. The above positioning method is positioned by a property of the element, if an element does not have an ID, name, class attribute, or hyperlink, do it? Or it's a lot of properties that are duplicated. At this point, you can use XPath to solve2.xpath is a path language, with the above positioning principle is not the same, first first step to learn to use the tool to view the XPath of an e
"hao123", just enter "ao123" can also be located toElement positioning: Find_element_by_xpath ()1. The above positioning method is positioned by a property of the element, if an element does not have an ID, name, class attribute, or hyperlink, do it? Or it's a lot of properties that are duplicated. At this point, you can use XPath to solve2.xpath is a path language, with the above positioning principle is not the same, first first step to learn to use the tool to view the XPath of an element3.
[3] Just learned some simple exercises for Python and several exercises for pythonPython dating entertainment club: 613176398
(1) name = "aleX leNb"
1) Remove the spaces on both sides of the value corresponding to the name variable and output the processing result.
Name="AleX leNb"Print(Name, name. strip())
2) Remove 'al' on the left of the name variable and output the processing result.
print(name.lstr
1.the use of ' with open ... '2.the use of pickle (dump and load)For STEP1:The ' with open ... ' is the short format of ' try...except...finally 'For STEP2:You can store a list with pickle.dump () and get the content again with Pickle.load ()1>>>ImportPickle2>>> with open ('Test.pickle','WB') as data:3Pickle.dump (['a','2','et'],data)4 5 6>>> with open ('Test.pickle','RB') as ReadFile:7The_list =pickle.load (readFile)8 9 Ten>>>the_list One['a'
: parentheses are used to receive Parameters. if more than one parameter is passed in: the value should be passed in the first position and then the specific incoming order should be determined according to the parameters defined by the function 3. Return value If the function has a return value, you should also define "variable" to receive the return value if the return value has more than one, You can also use multiple vari
Third, cross-site request forgeryFirst, IntroductionDjango provides users with the ability to prevent cross-site request forgery, which is accomplished through middleware django.middleware.csrf.CsrfViewMiddleware. For Django, the ability to set up anti-cross-site request forgery is divided into global and local.Global:Middleware Django.middleware.csrf.CsrfViewMiddlewareLocal:
@csrf_protect, force the anti-cross-site request forgery feature for the current function, even if the global mi
simultaneouslytry: x = float (' blah ') except (ValueError, nameerror): Print ("Caught both types of exceptions")Another change to exception handling is the exception chain -implicit or explicit. Listing 6 shows an example of an implicit exception chain.Listing 6. Implicit exception chains in Python 3Def divide (A, B): try: print (A/b) except
,height=1,fg= ' red '). Pack () bg: Background colorTkinter. Button (form, text= ' Hello button ', width=10,height=1,bg= ' Blue '). Pack ()Where the text appears on the buttonProperty anchorIts value has these 8 directionsN (North), S (south), W (west), E (East) and NE,NW,SE,SW,Already Northwest direction for exampleTkinter. Button (form, text= ' Hello button ', width=20,height=5,anchor= ' NW '). Pack ()Button styleProperty reliefTkinter. Button (form, text= ' Hello button ', Relief=flat). Pack
From the blog: Shanghai-leisurelyOriginal address: http://www.cnblogs.com/yoyoketang/tag/python%E6%8E%A5%E5%8F%A3%E8%87%AA%E5%8A%A8%E5%8C%96/ObjectiveA cock silk man a summon up the courage to the goddess B call vindicate, Goddess B is a scheming to think that the cock silk man A is a good person, do not want to directly refuse to set the call transfer to the Girlfriends C, the final cock silk male A and the goddess Girlfriends C success, this scene i
IfConditional judgment is to execute a program fragment when a condition is true, otherwise execute another.3if age >= 18: print(‘your age is‘, age) print(‘adult‘)else: print(‘your age is‘, age) print(‘teenager‘)So the basic format of the IF statement is:条件判断1>: 执行1>elif 条件判断2>: 执行2>elif 条件判断3>: 执行3>else: 执行4>If the statement is judged from the top down, if it is in a certain judgment True , the state
'% (DH, h)) if DH! = H Else Open (Os.pat H.join (IPP, PF), ' WB '). Write (by) 2.3 If you click Perference, the package Control option succeeds, or the installation fails, the failure is nothing, you can configure the environmentThree, configuration packageClick on the new package Control, enter installEnter the installation interface: I install two plugins myself:1.SideBarEnhancements = Sidebar Management2.Anaconda (the strongest
Python [3]-dictionary dic And set, python dictionary dicsetI. dictionary dict
Dict is stored as a key-value pair. The creation method is to use braces {} and separate the key and value with a colon.
>>> d={'chen':60,'zhang':80}>>> print d{'chen': 60, 'zhang': 80}
Assignment operation
>>> d['chen']=65>>> print d{'chen': 65, 'zhang': 80}
Value: get (). You can set
1. Install the latest version of the official web sublime text software, it must be the original official website, not the Chinese version of the so-called official website! Chinese version is after others cracked, but also add plug-ins, this is not the most important, the most important thing is: their pakage control can not use!!!! Reload also no way to save, originally card here for a long time, very tangled, now use back to the original, feel really is the world I have like smooth and silky!
conversion result is falsestring str :Created: a = "123", a = ' 123 ', a = str (123) A = str (123)Conversion: b = 123 A = str (b)string concatenation: a = "Hello" b = "World" A + b = ' HelloWorld 'string formatting:%+[s.d , etc.]A = "This is%s year,%s month%s Day"% (2017,4,29) The last result is a = "This is 2017, April 29."The percent symbol is called a placeholder, the red% is the delimiter, and the next 2017 4 29 will correspond to the placeholder in the replacement quotation mark if there i
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