如何在特定子字符串后获取字符串.
例如,我想以后得到的字符串"world"中my_string="hello python world , i'm a beginner "
我有这些客户端和服务器代码的问题,我一直得到[Errno 10061]无法建立连接,因为目标机器主动拒绝它
我在使用Windows XP SP3的虚拟机上运行服务器,在Windows 7 64bit上运行客户端,我的python版本是2.7.3.我想知道的是我应该如何编辑代码以在不同的网络上使用客户端和服务器!谢谢!
服务器:
#!/usr/bin/python # This is server.py file
import socket # Import socket module
s = socket.socket() # Create a socket object
host = '0.0.0.0' # Get local machine name
port = 12345 # Reserve a port for your service.
print 'Server started!'
print 'Waiting for clients...'
s.bind((host, port)) # Bind to the port
s.listen(5) # Now wait for client connection.
c, addr = s.accept() # Establish connection with client.
print 'Got connection …Run Code Online (Sandbox Code Playgroud)