I have the following piece of code where I want to delete combinations like 1\n, 2\n, 3\n etc. from the string. It seems to me there should be a better way to exclude the combination rather than just enlist them all. Thanks in advance
instr_delete = ['\r', '1\n', '2\n', '3\n', '4\n', '5\n', '6\n', '7\n', '\n']
for bad_sign in instr_delete:
if bad_sign in instructions:
instructions = instructions.replace(bad_sign, '')