# cat test.dat
1 --- I
2 --- L
3 --- O
4 --- V
5 --- E
6 --- Y
7 --- O
8 --- U
9 --- !
10 --- !
# cat r.py
import sys,random
lines = sys.stdin.readlines()
olines=[]
while lines:
olines.append(lines.pop(random.randrange(len(lines))))
sys.stdout.write( "".join(olines))
# cat test.dat python r.py
6 --- Y
4 --- V
8 --- U
5 --- E
3 --- O
2 --- L
1 --- I
10 --- !
7 --- O
9 --- !
(出处:http://www.sheup.com)