The urllib3 is the new package in Python that will replace urllib2, the urllib2 package has been remove form Python package library.
To parse web page source and HTML, we also need BeautifulSoup4, it will parse the html source to a DOM tree and then we can do various queries on this tree data structure, for example you can find element by css selector, just like jQuery.To parse web page source and HTML, we also need BeautifulSoup4, it will parse the html source to a DOM tree and then we can do various queries on this tree data structure, for example you can find .
The full class name of this type is ctypes.wintypes.LP_c_long, when I programming a script using win32 API, I sometimes get a HWND object of this type. But the HWND also could be returned as int type.
I get two HWND point to the same window but with different type, compare them with == always return False.
Python, especially version 2 is notorious for unicode decoding and encoding problem. I had been bitten by it in the era of Python2, and its painful . The unicode API in Python 2 is borken, inconsisitent and confusing.
Now we using Python 3. It supposed to be better. But I still hit the brick wall in Python 3. I have a little interest in figuring out whats really going on in most cases, the only thing want is to find a quick solution to make it stop throwing any encoding exceptions.Now we using Python 3. It supposed to be better. But I still hit the brick wall in Python 3. I have a .
Insertion sort algorithm is a simple algorithm, its an iterative algorithm, without incurring recursive. Because it didn't take the divide and conquer approach. It just compare and move elements around in the array.
I had written it in PHP.
QuickSort is one of the mostly used sort algorithm in CS. It has the best average performance.
The algorithm is very simple and elegant , its a recursive algorithm, at each recursive, one pivot is selected and divide the array into two sub arrays, one less than the pivot and another one bigger than it.
Test driven, I bet you must have heard of it in many different places. It already expanded to almost all languages and platform. This post will show you testing in Python.
If you have Python, you have doctest, it shipped with Python. We will start from this one.
Exception handling is a de facto language feature now, but different language has different view of it. Personally, I prefer handling exception with language feature other than logical code. It makes the code much easier to read.
This is a simple example in Python show a message when trying to open a file that not exist.