AttributeError: ‘module’ object has no attribute ‘GetoptError’

If you are new to Python and trying some examples on the net, you might come across with this error as I did. I was trying the getopt module example at https://docs.python.org/2/library/getopt.html When I tried to run the code I got the below output.

The code was as below.

I didn’t understand in the beginning […]