+ 1

Tcp server python

so, i bought a book to learn python.then i write the exactly same the code what that book said.here the code. https://code.sololearn.com/cZDdvAxhGCQy/?ref=app the book said,its using python 2.7.but i tried both 2.7 and 3.5.none of them working.whats wrong?

28th Jul 2017, 9:55 AM
Kevin AS
Kevin AS - avatar
5 odpowiedzi
+ 2
On line 9, try passing a tuple instead of 2 arguments, like this: server.bind( (bind_ip, bind_port) )
28th Jul 2017, 10:13 AM
Eligijus Silkartas
Eligijus Silkartas - avatar
+ 2
They are string format symbols. When you start your program, instead of %s it prints a string and instead of %d it prints an integer number print("ip address: %s, port number: %d" % ("127.0.0.1", 80)) will print: ip address: 127.0.0.1, port number: 80
28th Jul 2017, 11:43 AM
Eligijus Silkartas
Eligijus Silkartas - avatar
+ 2
Thanks, but I am not. Everyone can learn these things, just need to study a lot
28th Jul 2017, 12:01 PM
Eligijus Silkartas
Eligijus Silkartas - avatar
+ 1
and can u e explain me what is the mean %s :%d ?
28th Jul 2017, 11:12 AM
Kevin AS
Kevin AS - avatar
+ 1
bravo.ur genius
28th Jul 2017, 11:48 AM
Kevin AS
Kevin AS - avatar