darkneter at gmail.com
Thu Jul 30 12:06:11 EDT 2009
On Jul 30, 6:56 am, "Mark Tolonen" <metolone+gm... at gmail.com> wrote:
> "NighterNet" <darkne... at gmail.com> wrote in message
> news:55aba832-df6d-455f-bf34-04d37eb061cd at i4g2000prm.googlegroups.com...
> >I am trying to figure out how to send text or byte in python3.1. I am
> > trying to send data to flashsocketto get there. I am not sure how to
> > work it.
> > buff= 'id=' , self.id , ':balive=False\n'
> > clientSock.send(buff);
> > --
> Python3.1strings are Unicode (think characters not bytes). When writing
> to files, sockets, etc. bytes must be used. Unicode strings have an
> encode() method, where you can specify an appropriate encoding (ascii,
> latin-1, windows-1252, utf-8, etc.):
> When reading from thesocket, you can decode() the byte strings back into
> Unicode strings.
> data = clientSock.recv(1024).decode('ascii')
I am not sure how to use struct package.
Here an example for the input:
More information about the Python-list