Skip to content

Instantly share code, notes, and snippets.

@SudhenduP
Created June 20, 2020 05:28
Show Gist options
  • Save SudhenduP/8f12c1c5ab94bfc77f9fad299ace84b0 to your computer and use it in GitHub Desktop.
Save SudhenduP/8f12c1c5ab94bfc77f9fad299ace84b0 to your computer and use it in GitHub Desktop.
def check_create_status(severportfile):
print ('Reading from files: ' +severportfile)
get_file= get_checklist(severportfile)
for i in range(len(get_file)) :
print("Started Processing")
address = get_file.loc[i, "IP"]
port = get_file.loc[i, "Port"]
check = check_server(address, port)
#get_file = get_file.append({'Status':check},ignore_index=True)
get_file.loc[i, 'Status'] = check
print (check)
#print(get_file)
print("Finished Processing")
result_dirname = os.getcwd()+ '\\result'
result_filename ='out_server_port.csv'
if not os.path.exists(result_dirname):
os.mkdir(result_dirname)
fullname = os.path.join(result_dirname, result_filename)
get_file.to_csv(index=False, path_or_buf=fullname)
print('Result written to file. Please check the file: ' +fullname)
sys.exit(not check)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment