On Jun 18, 7:52 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Tue, 17 Jun 2008 09:39:07 -0400, "John Salerno" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > > > > while True: > > > data = raw_input('> ') > > > if not data: > > > break > > > client_socket.send(data) > > > data = client_socket.recv(buffer_size) > > > if not data: > > > break > > > print data > > > > client_socket.close() > > > Also, is that second "if not data: break" statement necessary? It seems like > > once you get past the first if, you don't need the second one. Of course, I > > guses it's possible that the server could return a False value, but even > > still, would it make sense to break out of the loop and close the connection > > because of that? > > The first if is checking for lack of interactive input -- and, as > coded, will never break out as ANY response to the > prompt will have a > newline attached. > [snip] FYI, I've just checked:
>>> raw_input('> ') > abc 'abc' raw_input() doesn't put a newline on the end. -- http://mail.python.org/mailman/listinfo/python-list