更合高明网站建设,网站开发技术 包括,网站建设的客户需求分析调研表,网站首页index.html我正试着把字典写成一个txt文件。然后用raw_input键入键来读取dict值。我觉得我只是错过了一步#xff0c;但我已经找了一段时间了。我知道这个错误File name.py, line 24, in readingprint whip[name]TypeError: string indices must be integers, not str我的代…我正试着把字典写成一个txt文件。然后用raw_input键入键来读取dict值。我觉得我只是错过了一步但我已经找了一段时间了。我知道这个错误File name.py, line 24, in readingprint whip[name]TypeError: string indices must be integers, not str我的代码#!/usr/bin/env pythonfrom sys import exitclass Person(object):def __init__(self):self.name self.address self.phone self.age self.whip {}def writing(self):self.whip[p.name] p.age, p.address, p.phonetarget open(deed.txt, a)target.write(str(self.whip))print self.whipdef reading(self):self.whip open(deed.txt, r).read()name raw_input( )if name in self.whip:print self.whip[name]p Person()while True:print Type:\n\t*read to read data base\n\t*write to write to data base\n\t*exit to exitaction raw_input(\n )if write in action:p.name raw_input(Name?\n )p.phone raw_input(Phone Number?\n )p.age raw_input(Age?\n )p.address raw_input(Address?\n)p.writing()elif read in action:p.reading()elif exit in action:exit(0)