How to use StringIO in Python3?

I am using Python 3.2.1 and I can’t import the StringIO module. I use io.StringIO and it works, but I can’t use it with numpy‘s genfromtxt like this: x=”1 3\n 4.5 8″ numpy.genfromtxt(io.StringIO(x)) I get the following error: TypeError: Can’t convert ‘bytes’ object to str implicitly and when I write import StringIO it says ImportError: … Read more

Scanner is skipping nextLine() after using next() or nextFoo()?

I am using the Scanner methods nextInt() and nextLine() for reading input. It looks like this: System.out.println(“Enter numerical value”); int option; option = input.nextInt(); // Read numerical value from input System.out.println(“Enter 1st string”); String string1 = input.nextLine(); // Read 1st string (this is skipped) System.out.println(“Enter 2nd string”); String string2 = input.nextLine(); // Read 2nd string … Read more