En Fri, 23 Mar 2007 04:25:52 -0300, sandeep patil <[EMAIL PROTECTED]> escribió:
> i have install python on window xp os. > C:/program files/python > > i have done print program it working but .py can't working > help me to how i will execute this file this file where i will save > it. > path execution how . > tell me about any envorment veriable in python to set before python > editor run,it path. etc You don't need to set any environment variable to run Python. (Perhaps PYTHONPATH, but *only* if you put modules into non standard places) >>>> import posix > > Traceback (most recent call last): > File "<pyshell#4>", line 1, in <module> > import posix > ImportError: No module named posix That's ok: there is no module named "posix" on Windows, it is only available on Unix systems. I've rearranged a bit your example. Write the following into a file named test.py - use whatever editor you like (even notepad): ---begin file test.py--- def invert(table): index = {} for key in table: value = table[key] if not index.has_key(value): index[value] = [] index[value].append(key) return index phonebook = {'sandeep':9325, 'amit':9822, 'anand':9890, 'titu': 9325} print "Phonebook", phonebook inverted_phonebook = invert(phonebook) print "Inverted phonebook", inverted_phonebook ---end file test.py--- Then open a console window, change to the same directory where you saved test.py, and execute: python test.py You should get: Phonebook {'titu': 9325, 'amit': 9822, 'anand': 9890, 'sandeep': 9325} Inverted phonebook {9890: ['anand'], 9325: ['titu', 'sandeep'], 9822: ['amit']} There are plenty of tutorials about Python. A good book -among others- is "Dive into Python"; you can buy the book, read it online, or even download it from http://www.diveintopython.org/ -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list