usr bin python data for example ____________________ _________________

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python
# data for example _________________________________________________________________________
a = [{'id':'1','parrent':0,'title':'mr.Globe'}]
b = [{'id':'2','parrent':0,'title':'sir David'},{'id':'3','parrent':1,'title':'child_1'}]
c = [{'id':'4','parrent':0,'title':'good'},{'id':'5','parrent':1,'title':'child_A'}]
d = [{'id':'6','parrent':0,'title':'fuck'},{'id':'7','parrent':1,'title':'child_B'}, {'id':'8','parrent':2,'title':'child_C'}]
main = [a,b,c,d]
# __________________________________________________________________________________________
for arr in main:
for x in arr:
if x["parrent"] == 0:
print "<option value=\"%s\">%s</option>" % (x["title"], x["title"])
else:
print "<option value=\"%s\">%s</option>" % ("-"*x["parrent"]+x["title"], "-"*x["parrent"]+x["title"])