If you have any doubts, please give me comment...
Code:
import sys
P = sys.argv[1]
F = sys.argv[2]
L = sys.argv[3]
B = sys.argv[4]
f = open(P, "r")
lines = f.readlines()
f.close()
f = open(P, "w")
for line in lines:
line = line.strip()
if F==line[:16].strip() and L ==line[16:32].strip():
print("%-16s%-16s%-16s"%(F,L,B), file=f)
else:
print(line, file=f)
f.close()
B Codio - IT-140-R5545 Intro Mail - thon a https://codio.com/twinters/file-handling:5cb76949180630 Codio Project File Edit Find View...
#Get the filepath from the command line import sys P= sys.argv[1] F= sys.argv[2] L= sys.argv[3] B= sys.argv[4] # # Our Helper functions: # # Loads the file at filepath # Returns a 2d array with the data def load2dArrayFromFile (filepath): # Your code goes here: 1 2 23 # # Searches the 2d array 'records' for firstname, lastname. # Returns the index of the record or -1 if no record exists 24 25 # def findIndex ( records, firstname, lastname)...