Python Forum
how can i send a list of tuples from the server to the client using sockets? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: how can i send a list of tuples from the server to the client using sockets? (/thread-25852.html)



how can i send a list of tuples from the server to the client using sockets? - dafdaf - Apr-13-2020

I have a list of tuples that I don't know the length of (I selected it from a sqlite3 database table).

how can I send this list from the server to a client using sockets so that the client could access the values of the list and the tuples and use them? All tuples contain 4 string values.

data = [("cooking","josh", "recepie", "cookies") ,
("fashion", "jessica", "shopping", "dresses"),
("sport", "jake", "basketball", "kobe bryant")]

how can i send this 'data' list of tuples from the server socket to the client socket so that he could access its values?

I'd really appreciate it if you could help me ! Smile


RE: how can i send a list of tuples from the server to the client using sockets? - Larz60+ - Apr-13-2020

SQL has built-in for getting count of query.
simple example: select count(mycolumn) from mytable where myfilter;
for the socket part, see: https://docs.python.org/3.8/howto/sockets.html