Skip to content

Instantly share code, notes, and snippets.

@masahitojp
Created January 5, 2011 02:14
Show Gist options
  • Save masahitojp/765830 to your computer and use it in GitHub Desktop.
Save masahitojp/765830 to your computer and use it in GitHub Desktop.
calc.py
import sys
if len(sys.argv) > 1:
expression = sys.argv[1]
expression = expression.replace("x","*")
print( eval(expression) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment