Sunday, June 17, 2012

python tricks

1.      String to dict
eval(string)
or
import ast
ast.literal_eval(string)

the later one is considered to be safer

2.      The config parser module use cap letter for section name, and uncap for options , no matter what is the input.



No comments:

Post a Comment