python - AttributeError: 'str' object has no attribute -
i new in python. have 2 dict , 1 list , process on recapitulation method.
system_list= ['cassandra', 'flume', 'hbase', 'hdfs', 'mapreduce', 'zookeeper'] allaspects= {'flume': [19.0, 13, 46, 5, 100, 0, 6, 6, 0], 'hdfs': [161.0, 221.0, 232.5, 8.0, 60.0, 7.5, 16, 70, 10], 'zookeeper': [40.0, 66, 67, 13, 36, 1.5, 2, 19.5, 6], 'mapreduce': [161, 23, 11, 79, 41, 6.5, 8.5, 101.5, 8], 'hbase': [270.75, 573, 264, 197, 426, 7.0, 12.5, 91, 4], 'cassandra': [404, 453, 287, 17, 307, 1.0, 10, 31, 26]} allaspects_big= {'flume': [18.0, 119.0, 43.0, 3.5, 81.0, 0, 6.0, 4.5, 0], 'hdfs': [152.5, 214.0, 221.5, 7.0, 56.0, 6.0, 14, 68, 10], 'zookeeper': [33, 55, 56, 13, 28, 1.0, 1, 16.0, 3.5], 'mapreduce': [152, 219, 106, 71, 34, 6.5, 7.5, 91.0, 7.0], 'hbase': [227, 505, 233, 170, 320, 6.0, 12.5, 84, 4], 'cassandra': [195, 271, 177, 10.5, 156, 1.0, 6, 16, 20]} def recapitulation(system_list, total): count = {} msg ="" # print total scheme in system_list: count[system] = 0 info in total[system]: count[system] = count[system] + info msg= msg+""+system+"("+str(int(count[system]))+")" if(system == 'zookeeper'): msg= msg+"." else: msg= msg+", " homecoming msg i set of script in same file. if run 1 dict (execute a3 or a3b in case) method give string output. when run a3 , a3b( see @ below) together. error 'str' has no attribute.
a3 = recapitulation(system_list ,allaspects) a3b = recapitulation(system_list, allaspects_big) error:
a3b = recapitulation(system_list, allaspects_big) attributeerror: 'str' object has no attribute 'allaspects_big' full traceback:
traceback (most recent phone call last): file "py/parse-all.py", line 2537, in <module> a3b = recapitulation(system_list, a3.allaspects_big) attributeerror: 'str' object has no attribute 'allaspects_big' i don't have thought solve this. please give me suggestion. what's wrong scripts. thanks!
your code not consistent traceback. you're running:
a3b = recapitulation(system_list, allaspects_big) but traceback shows:
a3b = recapitulation(system_list, a3.allaspects_big) # ^ what?! a3 string, returned recapitulation. hence does not have allaspects_big attribute. think wanted pass allaspects_big, remove a3. create code you're running claim are.
python string list dictionary type-conversion
No comments:
Post a Comment