Session Ready
Exercise

Backwards day

A colleague has written a Python script that reverse all lines in a file and prints them out one by one. This is an integration tool for some NLP (Natural Language Processing) work your department is involved in. You want to call their script, reverseit.py from a python program you are writing so you can use it as well. Use your knowledge of sys.argv and subprocess to write a file, then pass that file to the script that processes it.

Instructions
100 XP
  • Write two lines to a file input.txt.
  • Use the subprocess module to run the reverseit.py script with input.txt as an argument.
  • Print out the results.