Wednesday 15 May 2013

python - Can I use a value as a key for another dict? -


What I'm trying to do is, it's a word that

  (like category 1: subcategory 1, all 2, all 3), (Cat 2: all 12, all 22 ...))   

However, I sub-sections of their own values wants to be with me:

  (subcat1: subitem1, subitem2), (subcat2: subitem12, subitem22) ...)   

I subitem reference Would like to be able to do this as it connects in the original category, not just the subcategory Is there any way to do this?

Edit: Import raw_files import json import import import glob glob as win32 from win32com.client io import local collection of import see the default import Piprint # import customers must re = glob ( ' *. Xlsx ') x = locale.getpreferredcoding () Print X ex = win32.gencache.EnsureDispatch (' Excel.Application ') ex.Visible = False oFile = open ( "rawsort .txt", "w +") #oFile = io.open ( "rawsort.txt", "w +", encoding = "UTF -8") # for f text dump raw_files: ex.Workbooks.Open (f) sheets = Ex.ActiveWorkbook #print sheet. Sheets ("MRD"). Room (1,2). Value wincs = sheet.Worksheets ('MRD') if Sheet. Sheet ("MRD"). Cells (1, 3). Price == None: wincs.Cells (1,3). Price = UN / A 'Sheet. Sheet ("MRD"). Room (1, 4). Price == None: wincs.Cells (1, 4). Value = u'n / a 'if sheet Sheet ("MRD"). Room (1, 5). Price == None: wincs.Cells (1,5) Value = UN / A 'if not wincs.Cells (1,2) .Value == None: Category [sheet. Sheet ('MRD'). Room (1,2) .value] [wincs.Cells (1,3). Value] [wincs .cel (1,4) .vol] = Wincs.Cells (1,5). Value # Print List Print Sheet Sheet ('MRD'). UsedRange.Rows.X X (2, Sheet Sheets ("MRD") UsedRange.Rows.Count + 1 in UsedRange.Rows.X Exchange: If the sheet to print via # paragraph for loop. Sheet ("MRD"). Cell (x, 3). Value == None: wincs.Cells (x, 3). Value = u'N / A 'if Sheet. Sheet ("MRD"). Room (X, 4). Price == None: wincs.Cells (x, 4). Price = UN / A 'Sheet. Sheet ("MRD"). Room (X, 5). Value == None: wincs.Cells (x, 5). Price = UN / A 'if not sheet. Sheet ("MRD"). Cell (x, 2) Price == None: Category [Sheet. Sheets ('MRD'). Room (X, 2). Value] [winks. Seals (X, 3). Value] [winks. Seals (X, 4). Value] = winks Seals (X, 5). Value # Ofailklikit (Unicode (list)) oFile.write ( "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ n ") oFile.close ()

However, this is my output:

problems

any Also help?

For example, if you want a tree data structure, see how you have a You can apply.

No comments:

Post a Comment