forked from mrlan/EnglishPal
				
			优化了原来同学的代码格式
							parent
							
								
									e42309184d
								
							
						
					
					
						commit
						6c2a9823af
					
				|  | @ -1,8 +1,7 @@ | ||||||
| import json | import json | ||||||
|  | 
 | ||||||
| from flask import Blueprint | from flask import Blueprint | ||||||
| from wordfreqCMD import * | 
 | ||||||
| from Article import get_today_article, load_freq_history |  | ||||||
| import pickle_idea |  | ||||||
| import pickle_idea2 | import pickle_idea2 | ||||||
| 
 | 
 | ||||||
| path_prefix = '/var/www/wordfreq/wordfreq/' | path_prefix = '/var/www/wordfreq/wordfreq/' | ||||||
|  | @ -16,7 +15,7 @@ def helper(res, result): | ||||||
|     for item in res: |     for item in res: | ||||||
|         if type(res[str(item)]) == 'dict': |         if type(res[str(item)]) == 'dict': | ||||||
|             helper(res[str(item)], result) |             helper(res[str(item)], result) | ||||||
|         if type(res[str(item)])== 'list': |         if type(res[str(item)]) == 'list': | ||||||
|             for i in range(len(res[str(item)])): |             for i in range(len(res[str(item)])): | ||||||
|                 helper(res[str(item)][i], result) |                 helper(res[str(item)][i], result) | ||||||
|         result.append(str(item)) |         result.append(str(item)) | ||||||
|  | @ -29,7 +28,7 @@ def api_bp(username): | ||||||
|     result = [] |     result = [] | ||||||
|     user_freq_record = path_prefix + 'static/frequency/' + 'frequency_%s.pickle' % (username) |     user_freq_record = path_prefix + 'static/frequency/' + 'frequency_%s.pickle' % (username) | ||||||
|     s = pickle_idea2.load_record(user_freq_record) |     s = pickle_idea2.load_record(user_freq_record) | ||||||
|     wordlist = helper(s,result) |     wordlist = helper(s, result) | ||||||
|     print(json.dumps(s)) |     print(json.dumps(s)) | ||||||
|     results = {} |     results = {} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue