I read a file which contains:
> hello world Using the following code to read this file, but I can't read a part of it
with open("/home/pi/example1.txt") as f1: test = f1.readlines(0) print (test) print (test[0:2]) expected output:
Hello world He Output what I get
['helloworld\r\n'] ['helloworld\r\n'] What is the right (and SIMPLE) way to get a part of a substring what I grab from a file?