简体   繁体   中英

can i know what's problem in my simple python code when i use readlines?

I'm python beginner using jupyter-lab and i'm trying to open the text file and want to get the data from text file. Even though it is very simple code, return is weird.

what is problem?????

My code:

import os

f=open("C:/Users/dfdfdfd/Desktop/python/list.txt","rt")

lines = f.readlines

lines

----------------return------------------

<function TextIOWrapper.readlines(hint=-1, /)>

readlines is callable.

with open("C:/Users/dfdfdfd/Desktop/python/list.txt","rt") as f:
    lines = f.readlines()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM