Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

python - What can be used instead of ast module? -


in project evaluate json data extract information. code follows :

conn = httplib.httpconnection(host) conn.request("get", "/done_json.php") r = conn.getresponse() data = r.read() tmp = ast.literal_eval(data) list = [] in tmp.keys():     list.append(tmp[a]) 

how can change python 2.4 compatible ?


sample of json :

{'key_64': {'size3': 'cndcrncdf3fy09xl7uubcbcptye4h7ybg1i5milnbw172bmhvi.png', 'id': 'cndcrncdf3fy09xl7uubcbcptye4h7ybg1i5milnbw172bmhvi', 'size2': '', 'size1': 'http://dev.geco.com/site/2/cndcrncdf3fy09xl7uubcbcptye4h7ybg1i5milnbw172bmhvi.png'}, 'key_65': {'size3': 'cndcrnehlw2xffcc90pde77eejhjf6rc3r8pevuacb0c34h330.png', 'id': 'cndcrnehlw2xffcc90pde77eejhjf6rc3r8pevuacb0c34h330' (...)

don't use ast.literal_eval, it's wrong thing job anyway. use simplejson.load(r) (or standard json module instead of simplejson in newer versions).

ast.literal_eval designed evaluate python literals. json same, not entirely (true/false/null instead of true/false/none).


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -