I have a file requirement.txt file. the following text are below.How to change the value for django and flask and update the file by passing as command line argument
requirement.txt
numpy=1.14
pandas=1.4
django=1.6
flask=1.4
my python file.py is below
import sys
import re
program_name = sys.argv[0]
arguments = sys.argv[1:]
print (arguments[0])
print (arguments[1])
with open('requirement.txt ', 'r') as fr:
data = fr.readlines()
with open('requirement.txt ', 'a') as fw:
fw.write(....)
python file.py django=2.1 flask=2.0
output of requirement.txt
numpy=1.14
pandas=1.4
django=2.1
flask=2.0