At the beginning of a python script, there are some import statements. Could someone explain what they imply?
import getopt
import os
import re
import string
import sys
import getpass
import urllib
import subprocess
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
importstatements are similar (but different) to the#includestatements in C: they allow you to use functions defined elsewhere (either in a standard module, or your own).For example, module
sysallows you to do this:Which would terminate your program. Note that you did not have to write any code for the
exit()function, but it is defined within the standardsysmodule that ships with the interpreter.Any Python tutorial should explain this. For example, this.