![](/img/trans.png)
[英]I am having problem creating a unit test in python. can anyone let me know what's my mistake?
[英]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.