title: print current thread in python 3
body: <p>I have this script:</p>
  
  <pre><code>import threading, socket
  
  for x in range(800)
      send().start()
  
  class send(threading.Thread):
      def run(self):
          while True:
              try:
                  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                  s.connect(("www.google.it", 80))
                  s.send ("test")
                  print ("Request sent!")
              except:
                  pass
  </code></pre>
  
  <p>And at the place of "Request sent!" I would like to print something like: "Request sent! %s" % (the current number of the thread sending the request)</p>
  
  <p>What's the fastest way to do it?</p>
  
  <p><strong>--SOLVED--</strong></p>
  
  <pre><code>import threading, socket
  
  for x in range(800)
      send(x+1).start()
  
  class send(threading.Thread):
      def __init__(self, counter):
          threading.Thread.__init__(self)
          self.counter = counter
      def run(self):
          while True:
              try:
                  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                  s.connect(("www.google.it", 80))
                  s.send ("test")
                  print ("Request sent! @", self.counter)
              except:
                  pass
  </code></pre>