摘要:
expr_str="[1,2,3]" my_list=eval(expr_str) print(repr(my_list),type(my_list)) # [1,2,3] print(repr(expr_str),type(expr_str)) #'[1,2,3]' import ast # 用i 阅读全文
摘要:
import operator somelist = [(1,5,8),(6,2,4),(9,7,5)] somelist.sort(key=operator.itemgetter(0)) print(somelist) # [(1, 5, 8), (6, 2, 4), (9, 7, 5)] som 阅读全文