![](/img/trans.png)
[英]How can I make a recursive function that returns a list of sum of the same index given two lists.?
[英]How can I arrange this function so it returns a list with all this lists on it
所以我一直在做一個項目,我只能使用Tkinter。 問題是我需要我在別人的問題中找到的這個 function 返回一個列表,其中的列表已經打印,但我找不到實現這一點的方法。 目前,它會為 .txt 文件中的每一行打印一個列表,並且在每個列表中都有它所指的行的單詞。 我需要它來做到這一點,但所有那些列表,它的打印應該 go 在一個列表中。 我對此很陌生,很抱歉這個愚蠢的問題:
def file_to_list(file):
stop_words=open(file,'r')
lines = [line.split() for line in stop_words]
for line in lines:
print(line)
你已經有了答案
def file_to_list(file):
stop_words=open(file,'r')
lines = [line.split() for line in stop_words]
print(lines)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.