<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at. The query string (? and beyond) may be truncated.>
<In what way does your code behave incorrectly? Include ALL error messages.>
<What do you expect to happen instead?>
```pythonHi ,
I have a requirement to delete few lines from a textfile.
I will pass the input text file name , the starting line number and the line number upto which deletion should happen to my Python script from command line.
The constraint is, I do not want to use fileinput module of Python. I want to achieve the solution using file operation functions like seek() and tell(). I could write the program up to some extent but not able to get the desired result. Any help would be very much appreciated. Thanks.
> import sys
> filename, begin, end = sys.argv[1:4]
> begin, end = int(start), int(upto)
> f = open(filename, "r+")
> for lineno, line in enumerate(f):
> if begin <= lineno < begin + end:
> length = len(line)
> f.seek(-length, 1)
> f.write("")
> f.close()
<do not remove the three backticks above>