title: How replace a word in text file in specific position using Python
body: <pre><code>test_list = ['4', 'kg', 'butter', 'for', '40', 'bucks']
  print("The original list : " + str(test_list) )
  res = [sub.replace('4', '1') for sub in test_list ]
  print("\nThe list after substring replacement : " + str(res))
  </code></pre>
  
  <p>This program works for string. How to do the same type word replacement for a text file ?
  input file content:4, kg, butter, for, 40, bucks
  expected o/p file content : for,kg, butter,4, 40, bucks</p>