A trick to use numpy.loadtxt on strings
numpy offers a function, numpy.loadtxt, to read in an array from a file. This is a extremely useful function especially when a 2d array is being read. However the function only accepts either a file path/name, or a file generator (file handler). You can not use a string directly as the argument. numpy also offers …