Skip to content

Instantly share code, notes, and snippets.

@allieus
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allieus/03e005bfb89a86fd997d to your computer and use it in GitHub Desktop.
Save allieus/03e005bfb89a86fd997d to your computer and use it in GitHub Desktop.
지정한 여러 파이썬 쉘의 결과를 vimdiff 로 비교
#!/bin/sh
INTERPRETERS=( python2.5 python2.7 python3.4 )
if [ 1 -eq $# ]; then
script_path=$1
tempfiles=()
for interpreter in ${INTERPRETERS[@]}; do
tempfile=`mktemp -t ""`
$interpreter $script_path >$tempfile 2>&1
tempfiles+=($tempfile)
done
vimdiff ${tempfiles[@]}
for tempfile in ${tempfiles[@]}; do
rm $tempfile
done
exit 0
else
echo "usage> $0 <python-script-path>"
exit 1
fi
import sys
print(sys.version)
major_version = sys.version_info[0]
for i in range(1, 10):
print('{} * {} = {}'.format(i, major_version, major_version * i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment