how can i put a input to take the (( url )) for this function
<pre><code>import random
import urllib.request

def down_load_imag(url):
    name = random.randrange(1, 1000)
    full_name = str(name) + ".jpg"
    urllib.request.urlretrieve(url, full_name)

down_load_imag ("http://3.bp.blogspot.com/-WjQkpjkw9uQ/Vij8lG0pCdI/AAAAAAAAAJ4/-CifLZ5KG-Y/s1600/fedora_infinity_140x140.png") 
</code></pre>

<p>Python comes with the <a href="https://docs.python.org/3/library/argparse.html" rel="nofollow" title="argparse">argparse</a> module. Suppose your code lives in <code>downloader.py</code>, then add this:</p>

<pre><code>import argparse
import sys

parser = argparse.ArgumentParser(description="Download image to random filename")
parser.add_argument("--url", help="image url to download")
args = parser.parse_args() # parses sys.argv

url = args.url

if url is None:
    print("Give me an URL please!", file=sys.stderr)
    sys.exit(-1) 

down_load_imag(url)
</code></pre>

<p>Then use like this:</p>

<pre><code>python3 downloader.py --url http://what.ever.com/image.jpg
</code></pre>

<p>You can refine this to take the url using <code>input()</code> if <code>url</code> is None.</p>

python python-3.x