Python - Put a list in a threading module
<p>I want to put a list into my threading script, but I am facing a problem.</p>

<p>Contents of list file (example):</p>

<pre><code>http://google.com
http://yahoo.com
http://bing.com
http://python.org
</code></pre>

<p>My script:</p>

<pre><code>import codecs
import threading
import sys
import requests
from time import time as timer
from timeout import timeout
import time

try:
    with codecs.open(sys.argv[1], mode='r', encoding='ascii', errors='ignore') as iiz:
        iiz=iiz.read().splitlines()
except IOError:
    pass

oz = list(iiz)
def nnn(url):
    hzz = {'param1': sys.argv[2], 'param2': sys.argv[3]}
    po = requests.post(url,data=hzz)
    if po:
            print("ok \n")

if __name__ == '__main__':
    threads = []
    for i in range(1):
        t = threading.Thread(target=nnn, args=(oz,))
        threads.append(t)
        t.start()
</code></pre>



<p>Can you please clarify what elaborate on exactly what you're trying to achieve.</p>

<p>I'm guessing that you're trying to request urls to load into a web browser or the terminal...</p>

<p>Also you shouldn't need to put the urls into a list because when you opened up the file containing the urls, it automatically sorted it into a list. So in other words, the contents in iiz are already in the list format.</p>

<p>Personally, I haven't worked much with the modules you're using (apart from time), but I'll try my best to help you and hopefully other users will try and help you too.</p>

python multithreading list