Python 3 urlib library can help us to access network, in this tutorial, we will introduce how to send our data to server with http post method. You can learn how to do by following our tutorial.
When we crawl a web page, we send a http request header then will get a http response header. If we crawl successfully, we will get the content of this web page. In this tutorial, we will introduce how to get the string content of web page.
To crawl a web page, we should add some http request headers to our crawler to simulate browser. We can use urllib.request.Request() to build a request object to add some headers to do it. Meanwhile, we also can use urllib.request.build_opener() to create an OpenDirector object to crawl a web page. In this tutorial, we will add some request headers to OpenDirector object to simulate browser.
To get file size in python, we can use os.path.getsize() function, however, this function returns bytes of a file. In this tutorial, we will introduce you how to get a friendly file size.
Copying and moving file are common operations in python, in this tutorial, we will introduce you an easy way to copy and move file with shutil library. shutil allow you copy and move files directly, you do not need open and close file before copying or moving.
PyMuPDF RuntimeError: cycle in page tree will occur when you are iterating pdf page by page. In this tutorial, we will show you how to fix this problem.
To extract text (plain text or html text) from a pdf file is simple in python, we can use PyMuPDF library, which contains many basic pdf operations. In this tutorial, we will introduce you how to extract text from pdf files with it.
Python TypeError: ‘str’ object is not callable, which means we can not use a string to be a function. In this tutorial, we will write an example to show you how to fix this type error.
Resizing an image has three ways:To a fixed width and height, such as 1000*2000 to 512 * 512. The ratio of width and height usually is changed. To set width to a fixed value, the height is changed with ratio. To set height to a fixed value, the width is changed with ratio.In this tutorial, we will introduce you how to resize an image with these three situations.
Traversing a directory means get all files or subdirectories in it. To do it, we should know:How to check a file is file. How to check a file is directory. In this tutorial, we will write an example to show you how to traverse a directory in python.