簡體   English   中英

當我使用 readlines 時,我能知道我的簡單 python 代碼有什么問題嗎?

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

我是 python 使用 jupyter-lab 的初學者,我正在嘗試打開文本文件並希望從文本文件中獲取數據。 盡管它是非常簡單的代碼,但 return 很奇怪。

有什么問題?????

我的代碼:

import os

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

lines = f.readlines

lines

- - - - - - - - 返回 - - - - - - - - -

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

readlines 是可調用的。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM