#!/usr/bin/python
#coding:utf-8
import random
num=random.randint(1,10)
while True:
cai=int(raw_input('请输入随机数字:'))
if cai == num:
print '猜对了'
exit()
elif cai > num:
print '猜大了'
else:
print '猜小了'
非交互式的cp脚本
#!/usr/bin/python
#coding:utf-8
import sys
file1=sys.argv[1]
file2=sys.argv[2]
x=open(file1)
y=open(file2,'w')
for i in x:
y.writelines(i)
x.close()
y.close()
转载于:https://blog.51cto.com/13587189/2070084