Sina Weibo's API provides a multilingual interface in which Python's interface is provided by the user @ Liu Xuefeng.
Download address and Description: http://michaelliao.github.com/sinaweibopy/
Description Document: Https://github.com/michaelliao/sinaweibopy/wiki/OAuth2-HOWTO
You can also see here: http://code.google.com/p/sinaweibopy/wiki/OAuth2
The code is great, but there's a little bit of it that might make me wait for the rookie to understand:
Tuesday pm3 pips55moment (). Subtract (3,' Days '). Calendar (); --Last Friday pm3 pips55moment (). Subtract (1,' Days '). Calendar (); Yesterday afternoon3 pips55moment (). Calendar (); ---this afternoon3 pips55moment ().Add1,' Days '). Calendar (); Tomorrow afternoon3 pips55moment ().Add3,' Days '). Calendar (); This Thursday afternoon3 pips55moment ().Add10,' Days '). Calendar (); -2015April16thYou can also format the date using the following methodMoment (). Format (' L '); -2015-04-06momen
Today I found a very interesting feature, Python comes with a document viewer for all libraries, configured as follows:To configure the Pydoc service, enter the following code in CMD:python –m pydoc –p 1234After the carriage return, the window is not closed during use.Then, enter the URL in the browser: http://localhost:1234/, open the Python's own and integrated third-party library API.The interface looks like this:This tool is very handy for viewing
#-*-coding:cp936-*-Import Ctypesimport ctypes.wintypes#print (dir (ctypes)) #print (dir (ctypes.wintypes)) User32= cTYPES. Windll ("user32.dll") Findwindowa=User32. Findwindowagetwindowtexta=User32. Getwindowtextaenumwindows=User32. Enumwindows#windows callback function Def enumwindowproc (hWnd, LParam): Text=ctypes.c_char_p () Text.value=""getwindowtexta (hWnd, text, $) print (text.value)return 1#声明原型, note that you need to first declare the return value type Pfunc=cTYPES. Winfunctype (Ctypes.c
= driver.find_element_by_name ("cheese")OrFrom selenium.webdriver.common.by Import byCheese = driver.find_element (by.name, "cheese")by Link TextAn example of how to find an element such as the following:Cheese = Driver.find_element_by_link_text ("cheese")OrFrom selenium.webdriver.common.by Import byCheese = driver.find_element (by.link_text, "cheese")by Partial Link TextAn example of how to find an element such as the following:Cheese = Driver.find_element_by_partial_link_text ("cheese")OrFrom
变量titletitle = driver.title#控制台输出title信息print("当前网页的title属性是:",title)#断言编写 下面的断言是unittest框架的断言方法 后期会用到 这里只是为了属性编写#assertEqual(title,u"百度一下,你就知道","网页title属性值错误")
Gets the source code for the HTML and asserts thatdriver = webdriver.Firefox(executable_path = "d:\\geckodriver")fURL = "http://www.baidu.com"driver.get(fURL)driver.maximize_window()#获取网页HTML源代码 并赋值给pageSourcepageSource = driver.page_source#在控制台打印print(pageSource)#断言编写,查看源代码中是否有贴吧这两个字,一样是unittest框架断言#assertTrue(u"贴吧" in pageSource,
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.