注册 登录
编程论坛 Python论坛

dict与list嵌套问题

波悠悠的菠萝 发布于 2016-12-05 10:46, 3244 次点击
就是我读取一个txt文本文件,想要以字典dict输出,然后对字典中的数据以list形式进行操作,该怎么用?
def dic():
    dictionary={}
    student_txt=open('E:\\工作文件\\python\\work\\StudentList_0.txt','r')
    for line in student_txt:
        line=line.strip().split('\t')
        dictionary[line[0]]=line[1]+' '+line[2]+' '+line[3]+'班'
    #print(dictionary)
    count=0
求指教!!!!
0 回复
1