These two days have been busy writing a interactive program with the CMD module, just sleep until 5:00 in the morning, sleep last night to 2:00 last night. That is to achieve the automatic completion of the command, I didn't think that I would like to have such a small East East, I have the force of I nine. ! ! !
Fortunately, I finally realized, but now I want to think about it, I don't know how to do it, I will have a teacher who spends 20% of the efforts to get 80% efficiency, but I have to get 90 % Or more perfect effects may cost your additional 80% of hard !!! ", this time really wants to consider whether it needs to do this. In the future, I have to meet this kind of thing, I must consider clear! !
Doing this, there is an experience. Before doing something, you must have a certain plan, then implement it according to it, to analyze the possible problems, the knowledge you want to use is basically familiar. Just this matter, the work of my work in the first two days is unwanted, because in the final code, I have not implemented it in the past few days, because they can't meet my requirements. However, after reading the source code of the document and related modules, the original program is slightly retrofitted to realize the features I want. If you are able to calm down your heart, look at the source code, then it is not a half-time! ! !
Import cmdclass interactive (cmd.cmd): def __init __ (self): cmd.cmd .__ init__ (self) self.cmd = '' self.prompt = '>>>' DEF DO_TEST (Self, Arg): Self.cmd = Arg if self.cmd == '': print 'Input Sometying please!' if __name__ == '__main__': test = interactive () Test.cmdloop ()