我尝试在我的Mac上使用Python的图像模块(Mac新手),但我无法设置它.我有Yosemite,我在网上发现的一些帖子不起作用.我最终安装了Homebrew,终于在我的电脑上安装了PIL.但是,import image我不得不使用(我看到人们在网上做),而是使用from PIL import image.有没有之间关键的区别import Image和from PIL import Image.这是我第一次真正使用Image模块.
还有一个问题,我是否真的需要安装Homebrew和Macports等第三方工具来设置我的环境?
我是网络编程的新手,之前从未使用过Java进行网络编程.我正在使用Java编写服务器,我从客户端处理消息时遇到了一些问题.我用了
DataInputStream inputFromClient = new DataInputStream( socket.getInputStream() );
while ( true ) {
// Receive radius from the client
byte[] r=new byte[256000];
inputFromClient.read(r);
String Ffss =new String(r);
System.out.println( "Received from client: " + Ffss );
System.out.print("Found Index :" );
System.out.println(Ffss.indexOf( '\a' ));
System.out.print("Found Index :" );
System.out.println(Ffss.indexOf( ' '));
String Str = new String("add 12341\n13243423");
String SubStr1 = new String("\n");
System.out.print("Found Index :" );
System.out.println( Str.indexOf( SubStr1 ));
}
Run Code Online (Sandbox Code Playgroud)
如果我这样做,并有一个示例输入asg 23\aag,它将返回:
Found Index :-1
Found Index :3
Found Index :9 …Run Code Online (Sandbox Code Playgroud)