명령 줄에서 4 개의 인수를 받아들이고이를 사용하여 Python으로 파일을 만들려고합니다.명령 줄 인수를 파일에 인쇄하는 방법
내 구문은 다음과 같습니다
def configuredhcp(self,**kwargs):
''' Get the input parameters '''
client_ip = kwargs.get('client_ip',None)
client_mask = kwargs.get('client_mask',None)
option_routers = kwargs.get('option_routers',None)
option_broadcast = kwargs.get('option_broadcast',None)
range_ip = kwargs.get('range_ip',None)
infile = open('dhcpconf.txt', 'r+')
infile.write("Subnet %s netmask %s " % (client_ip ,client_mask)
infile.write("option routers %s " % (option_routers)
infile.write("option broadcast-address %s; " % (option_broadcast)
infile.write(" range %s;" % (range_ip)
infile.close()
내가 라인에 구문 오류
infile.write ("옵션 라우터 %의"% (option_routers)
정확한 코드 일 경우 일치하는 닫는 괄호가 없습니다. – Lafexlos