首页 > IT职业 > IT职场 > 猜1-10的数字python脚本
#!/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()
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2491/viewspace-2809692/ ,如需转载,请注明出处,否则将追究法律责任。