#!/usr/bin/python # -*- encode: utf-8 -*- from random import choice str = '321 choice([1,2,3]) 321' print eval(str)