-4
readme = open (r'c:\users\user\desktop\br.txt','r',encoding = 'utf-8')

print (readme.read) 

I have been trying to open a file, but this script isn't working, it says

built-in method read of _io.TextIOWrapper object at 0x00000000036A83A8

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 5
    You need to actually *call* the read method. Change `readme.read` to `readme.read()`. Note the parentheses. – idjaw Sep 12 '16 at 03:58
  • 1
    Possible duplicate of [How to read a file line by line into a list with Python](http://stackoverflow.com/questions/3277503/how-to-read-a-file-line-by-line-into-a-list-with-python) – gabra Sep 12 '16 at 11:50

1 Answers1

2

you want to call readme.read() method to read file.

readme = open (r'c:\users\user\desktop\br.txt','r',encoding = 'utf-8')
readme.read()

if you want to read file line by line you can use.

readme.readlines()
idjaw
  • 25,487
  • 7
  • 64
  • 83
Benjamin
  • 2,257
  • 1
  • 15
  • 24