|
| 1 | +cellRecAttrs = { |
| 2 | + u'C.Acoustic': ('acousticSpace',), |
| 3 | + u'C.Climate': ('climate',), |
| 4 | + u'C.Encounter': ('encounterZone',), |
| 5 | + u'C.ImageSpace': ('imageSpace',), |
| 6 | + u'C.Location': ('location',), |
| 7 | + u'C.Music': ('music',), |
| 8 | + u'C.Name': ('full',), |
| 9 | + u'C.Owner': ('ownership',), |
| 10 | + u'C.RecordFlags': ('flags1',), |
| 11 | + u'C.SkyLighting': ('',), |
| 12 | + u'C.Regions': ('regions',), |
| 13 | + u'C.Water': ('water', 'waterHeight', 'waterNoiseTexture', |
| 14 | + 'waterEnvironmentMap',), |
| 15 | +} |
| 16 | +cellRecFlags = { |
| 17 | + u'C.Acoustic': ('',), |
| 18 | + u'C.Climate': ('showSky',), |
| 19 | + u'C.Encounter': ('',), |
| 20 | + u'C.ImageSpace': ('',), |
| 21 | + u'C.Location': ('',), |
| 22 | + u'C.Music': ('',), |
| 23 | + u'C.Name': ('',), |
| 24 | + u'C.Owner': ('publicPlace',), |
| 25 | + u'C.RecordFlags': ('valu1', 'value2',), |
| 26 | + u'C.SkyLighting': ('useSkyLighting',), |
| 27 | + u'C.Regions': ('',), |
| 28 | + u'C.Water': ('hasWater',), |
| 29 | +} |
| 30 | +print cellRecAttrs |
| 31 | +print cellRecFlags |
| 32 | +print "cellRecAttrs:" |
| 33 | +for tags in cellRecAttrs: |
| 34 | + print "x: ", tags, ", atrs: ", cellRecAttrs[tags] |
| 35 | + print "Length of: ", tags, " = ", len(tags), \ |
| 36 | + ", Length of cellRecAttrs[x] : ", len(cellRecAttrs[tags]) |
| 37 | + print |
| 38 | + # for attr in tags |
| 39 | + # print "This is attr: ", attr |
| 40 | + print |
| 41 | +print |
| 42 | +print "cellRecFlags:" |
| 43 | +for x in cellRecFlags: |
| 44 | + print "x: ", x, "atrs: ", cellRecFlags[x] |
| 45 | + print "Length of: ", x, " = ", len(x), \ |
| 46 | + "Length of cellRecFlags[x] : ", len(cellRecFlags[x]) |
| 47 | + print |
| 48 | + |
| 49 | +list_of_lists = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] |
| 50 | +for list in list_of_lists: |
| 51 | + for x in list: |
| 52 | + print x |
| 53 | +print |
| 54 | + |
| 55 | + |
| 56 | +class Iterable(object): |
| 57 | + def __init__(self, values): |
| 58 | + self.values = values |
| 59 | + self.location = 0 |
| 60 | + |
| 61 | + def __iter__(self): |
| 62 | + return self |
| 63 | + |
| 64 | + def next(self): |
| 65 | + if self.location == len(self.values): |
| 66 | + raise StopIteration |
| 67 | + value = self.values[self.location] |
| 68 | + self.location += 1 |
| 69 | + return value |
| 70 | + |
| 71 | + |
| 72 | +attributes = ['water', 'waterHeight', 'waterNoiseTexture', |
| 73 | + 'waterEnvironmentMap'] |
| 74 | +print Iterable(attributes) |
| 75 | +print Iterable(attributes).next |
| 76 | + |
| 77 | +print |
| 78 | +class print_hi_not_bye: |
| 79 | + def __init__(self): |
| 80 | + self.name = "King" |
| 81 | + |
| 82 | + def hi(self): |
| 83 | + print(self.name) |
| 84 | + |
| 85 | +class_alias = print_hi_not_bye() |
| 86 | +class_alias.hi() # prints King |
| 87 | + |
| 88 | +print |
| 89 | + |
| 90 | +answer = 11 / 3 |
| 91 | +remainder = 11 % 3 |
| 92 | +string1 = "the answer is" |
| 93 | +string2 = "with a remainder of" |
| 94 | +print "%s %d %s %d" % (string1, answer, string2, remainder) |
| 95 | + |
| 96 | +print |
| 97 | + |
| 98 | +astring = "Hello Big World!" |
| 99 | +print "Hello = ", astring[0:5] |
| 100 | +print "Big = ", astring[6:9] |
| 101 | +print "World = ", astring[10:16] |
| 102 | +print "H = ", astring[0] |
| 103 | +print "B = ", astring[6] |
| 104 | +print "W = ", astring[10] |
| 105 | +print "Just B = ", astring[6:9:3] |
| 106 | +print "B and g not i = ", astring[6:9:2] |
| 107 | + |
| 108 | +word_array= ['R', 'e', 'd', ' ', 'T', 'w', 'o', ' ', 'B', 'i', 'g'] |
| 109 | +print word_array |
| 110 | +print len(word_array) |
| 111 | +print |
| 112 | + |
| 113 | + |
| 114 | +#R | e | d | | T | w | o | | B | i | g |
| 115 | +#0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 116 | +new_string = "Red Two Big" |
| 117 | +print "Red = ", new_string[-4:-0] |
| 118 | +print "Two = ", new_string[4:7] |
| 119 | +print "Big = ", new_string[8:11] |
| 120 | +print "RTB = ", new_string[0:10:4] |
| 121 | +print |
| 122 | + |
| 123 | +new_string = "Red Two Big" |
| 124 | +print "g = ", new_string[-1] |
| 125 | +print "i = ", new_string[-2] |
| 126 | +print "B = ", new_string[-3] |
| 127 | +something = new_string[-1:-4] |
| 128 | +print len(something) |
| 129 | +print "[empty] = ", new_string[-1:-4] |
| 130 | +other = new_string[-4:-1] |
| 131 | +print len(other) |
| 132 | +print " Bi = ", other |
| 133 | + |
0 commit comments