Python常用函数
一、取绝对值-abs()
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 a = -3 2 a = abs(a) 3 print(a)
二、字符串转字典-eval()
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 arg = '''{ 2 'bakend': 'www.oldboy.org', 3 'record':{ 4 'server': '100.1.7.9', 5 'weight': 20, 6 'maxconn': 30 7 } 8 }''' 9 10 arg = eval(arg) 11 12 print(arg)
一、取绝对值-abs()
1 a = -3 2 a = abs(a) 3 print(a)
二、字符串转字典-eval()
1 arg = '''{ 2 'bakend': 'www.oldboy.org', 3 'record':{ 4 'server': '100.1.7.9', 5 'weight': 20, 6 'maxconn': 30 7 } 8 }''' 9 10 arg = eval(arg) 11 12 print(arg)