file-manipulation

replace first character of each line in file python

replace first character of each line in file python Question: I am trying to replace some of the first characters in lines from multiple txt files and have this code but the output is wrong: for filename in glob.glob(‘./labels/**/*.txt’, recursive=True): with open(filename, ‘r’) as f: original_lines = f.readlines() with open(filename, ‘w’) as out: for line …

Total answers: 1