用split分割了字符串后,取出时显示:ValueError: need more than 0 values to unpack
文件是可以正常打开的....也读取了数据,但就是每次都显示ValueError: need more than 0 values to unpack代码如下:
程序代码:
stf_dict = {} f = file('stu_info.txt') for line in f: print line stf_id, stf_name, stf_mail, stf_company, stf_title, stf_phone = line.split() print line.split() stf_dict[stf_id] = [stf_name, stf_mail, stf_company, stf_title, stf_phone]文件stu_info.txt里的内容是:
stu1101 mingjia.xu 275896019@ 263 SystemAdmin 18810404260
stu1102 Yangjiansong jason@ A8music SystemAdmin 13601247960
stu1103 zouxinkai zouxinkai_2006@ jishubu systemadmin 1861214111
stu1102 Yangjiansong jason@ A8music SystemAdmin 13601247960
stu1103 zouxinkai zouxinkai_2006@ jishubu systemadmin 1861214111