Filename_version_dir = dir([(nam,filename:get_file_version(nam)) for nam in filename_version_list])
This is a list comprehension which returns a list of (name,ver). You should look at http://docs.python.org/library/stdtypes.html# and pay attention to lists and mapping types (dict) and all the things you can do with them. You should also go through the tutorial it doesn't take much time and will give you a good foundation. the append() method is for lists not dicts the for construct is the primary looping tool, the reserved word from is used in import statments. On Wed, May 2, 2012 at 5:25 AM, Aravind Kamble <arvind.kam...@gmail.com> wrote: > Hi All, > > Hope I am posting in correct mailing list. Am facing another problem now. My > logic is to get file versions of files inside two directories and compare > them. I am trying to get filename and version as key, value pairs in a > directory. I have a function written which will provide me the file version. > I have file names in a list. I am not able to populate my directory with > filename and version. Code snippet looks something like this, > > Filename_Version_dir={} > > from filename in filename_version_list: > # I want to populate my directory here with filename and version > given by the function get_file_version(filename) > # I want something like > Filename_Version_dir.append(filename:get_file_version) > > > What is the best thing I can do here? > > Thanks in advance, > > > > ./Aravind > > > > _______________________________________________ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32