Disassembling strings and turning them into function parameters

2005-01-30 Thread mercuryprey
Hi, I'm pretty new to Python, to programming overall...so how would I make something where the user inputs multiple words in a string - like "connect 123.123.123.123 21 user password" or similar, and then I can split this string up to pass these arguments to a function like ftp_connect(ip, port, us

Re: Disassembling strings and turning them into function parameters

2005-01-30 Thread mercuryprey
Hey, that's exactly what I need! Thanks for your help, the others too of course :) Didn't expect to get answers so quickly.. -- http://mail.python.org/mailman/listinfo/python-list

Problem with loading textfiles into dictionaries.

2005-01-30 Thread mercuryprey
Hello, I want to do the following: def do_load(self, arg): sitefile = file('sitelist', 'r+', 1) while True: siteline = sitefile.readline() site_rawlist = siteline.split() sitelist[site_rawlist[0]] = site_rawlist[1:] if len(siteline) == 0: break I want to load a textfile into a dictionaries and us

Re: Problem with loading textfiles into dictionaries.

2005-01-30 Thread mercuryprey
Yeah I kind of want to 'reinvent' the pickle and I am aware of that. The problem for me is that the output that pickle dumps to a file is too 'cryptic' as I want the ability to edit the corresponding textfile directly and easily, so I'm going for an own way. But yes, Kartic and you were basically