I am trying to extract data from a text file. I convert the text file from byte to string, as per the code below.
I want to extract specific data from the file. For that, if I read the file by using, for line in data2: print(line)
it is reading each character, not per word or per line. For example, instead of printing the full line it is printing each character as a line.
How can I read by line instead of by character?
data = urllib.request.urlopen('http://lib.stat.cmu.edu/datasets/boston')
data1 = data.read()
data2 = data1.decode("utf-8")