createfile

#!/usr/bin/env python
import os



from optparse import OptionParser  
import sys  



def gpv():

	print "create gpv"
	f = open('/root/WCB3000/Wireless/gpv','w')
	f.write("listen 1234") 
	f.write("\nconnect http://192.168.55.1:7547/ actiontec actiontec NONE")
	f.write("\nwait")
	f.write("\nrpc cwmp:InformResponse MaxEnvelopes=1")
	f.write("\nwait")
	f.write("\nget_params InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID")
	f.write("\nwait")
	f.write("\nrpc0")
	f.write("\nquit")
	f.write("\n")
	f.close

def spv():
	
	print "create gpv"
	f = open('/root/WCB3000/Wireless/spv','w')
	f.write("listen 1234") 
	f.write("\nconnect http://192.168.55.1:7547/ actiontec actiontec NONE")
	f.write("\nwait")
	f.write("\nrpc cwmp:InformResponse MaxEnvelopes=1")
	f.write("\nwait")
	f.write("\nset_params InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID=prince2g string")
	f.write("\nwait")
	f.write("\nrpc0")
	f.write("\nquit")
	f.write("\n")
	f.close


def main():  
    p = OptionParser()  
    p.add_option('-n','--name',dest='person_name',help='person\'s name',default='person1')  
    p.add_option('-a','--age',default=30, help='person\'s age')  
    p.add_option('-j','--job',default='software engineer', help='person\'s job')  
    #p.add_option('-a','--action', default='',help='operate jacs' )
    p.add_option('-p','--params',default='',help='the parameters that jacs need operate')
    p.add_option('-v','--value',default='',help='the value that jacs need set')
    options, args = p.parse_args()  
    print 'Hello %s' %options.person_name, ', age is %d' %int(options.age), ',job is %s' %options.job  

if __name__ == '__main__':  
    main()



你可能感兴趣的:(createfile)