i just want to know that in python socket programming, when to use socket_PF_PACKET and when to use socket.AF_INET, what are difference between both of them?
Use AF_INET if you want to communicate using Internet protocols: TCP or UDP.  This is by far the most common choice, and almost certainly what you want.
Use PF_PACKET if you want to send and receive messages at the most basic level, below the Internet protocol layer, for example because you are implementing the protocol yourself.  Your process must run as root (or with a special capability) to use PF_PACKET.  This is a very advanced option.  If you have to ask this question, you want AF_INET, not PF_PACKET.
difference between socket.PF_PACKET and socket.AF_INET in python