title: How to send bytes using python (example please!)
body: <p>I'm trying to create a simple thingermajigger in python at the moment just to test out sending UDP packets over a socket. I think that I'm getting my script perfectly fine other than using the socket.sendto command. I keep getting errors regarding the portion where "bytes" would go... either TypeError: an interget is required, or when I make it an interget TypeError: a string is required. Could someone provide me with an example of how to send a byte?</p>
  
  <p>the point in my script where I'm getting the error is as follows... please fill out an example as well as a possible explanation / documentation for a newbie.</p>
  
  <pre><code>#full script as requested
  
  import socket
  import random
  
  sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
  butes = random._urandom(1024)
   #originally found this as a way to generate bytes to send, but it didn't work out
  print("target IP: ")
  ip = input()
  print("port: ")
  port = input()
  
  while 1:
      sock.sendto(butes, (ip, port))
      print("Sent %s amount of packets to %s at port %s." % (sent,ip,port))
      sent += 1
  </code></pre>