I have a config file of format:
IP,username,logfile
IP,username,logfile1
IP,username,logfile2
I am giving code below to store text file lines into a list, but i need help with the code which can determine whether name of logfile is same as logfile1 or not please help
import csv
config_file_path = "config15.txt" # read config file and assign IP,username,logfile,serverpath,localpath
file = open(config_file_path, 'r')
reader = csv.reader(file)
all_rows = [row for row in reader] # appending config file contents in a list
output above code gives:
[['127.0.0.1', 'new34', 'logfile'], ['127.0.0.1', 'new34', 'logfile1']]
I want a code that compares and tell if name of logfile and logfile1 same or not and if same return true as output.
logfileandlogfile1do you mean any two of the filenames, of just the second and third ones in the config file, or something else? What if there are two pairs of filenames equal? What if three filenames are equal?