Python – Download all herl link in a website html

Excersie 01 : Download all herl link in a website html

We can use 02 library BeautifulSoup or HtmpParse to get the herl link in a website html.

I will update the script within today. Just wait.


Install Python and Django with Xampp on Windows 7

I will try to follow these tutorial to install XAMPP with Python and Django on my computer.

Link 1 :

Install Python and Django with Xampp on Windows 7

Link 2 :

Python, Django, & MySQL on Windows 7, Part 1: Installing Python, Pip, and iPython

Link 3 :

[Tutorial] install Apache + MySQL + Python on Windows

Feel stuck when install Python library behind a proxy server

Hi guys,

When you want to install Python library but you connect to internet through a proxy server. Don’t forget to run two commands below.

SET HTTP_PROXY=<proxyHost>:<proxyPort>
SET HTTPS_PROXY=<proxyHost>:<proxyPort>

Example :


After that you can use pip to install Python library.

pip install matplotlib

Python : Script to remove empty directory on your computer

Today, I checked my download folder and found that a lot of empty directories. Because I choose download by JDownloader (open source program to download from

Sometimes, you can not download all contents that you need and make the computer has a lot of empty directories. Because JDownloader automatically create a folder which contains the download files.

After searching on StackOverFlow, I found a very useful link and modified it so that it suited my situation. Check the script below :

import os
#declare the root directory
root_dir = ‘E:\\Your_download_directory
#initialize the counters
empty_count = 0
used_count = 0
#Set the file to write to, “x” will indicate to create a new file and open it for writting
for curdir, subdirs, files in os.walk(root_dir):
if len(subdirs) == 0 and len(files) == 0:
empty_count += 1 #increment empty_count
print(‘Empty Directory: {}’.format(curdir)) #print the empty directory
print(‘This empty directory was successful removed : {}’.format(curdir))
elif len(subdirs) > 0:
used_count += 1
print(‘Used directory:: {}’.format(curdir)) #print the used directory if you want.
print(‘The total empty directory in this folder : {}’.format(empty_count))

If you check the link below, you will find more useful thing to do with this script.

You can add the result to file and save it like a log file.

Link : Scan files recursively and delete empty directories in python

Reference to os.rmdir : Python os.removedirs() Method

I highly recommend you to only print the result of empty directory first. After that you can uncomment “os.rmdir(curdir)” to delete the result of empty.