Learning Resources
 

The from import statement


If you want to directly import the argv variable into your program (to avoid typing the sys. everytime for it), then you can use the from sys import argv statement. If you want to import all the names used in the sys module, then you can use the from sys import * statement. This works for any module.

In general, you should avoid using this statement and use the import statement instead since your program will avoid name clashes and will be more readable. Example:

from math import *  
n = input("Enter range:-  ")
p = [2, 3]
count = 2
a = 5
while(count < n):
	b = 0
	for i in range(2, a):
		if(i <= sqrt(a)):
			if(a % i == 0):
				#print a, "is not a prime" 
				b = 1
			else:
				pass
	if(b != 1):
		#print a, "is a prime"
		p = p + [a]
		count = count + 1
	a = a + 2
print p

-Swaroopch