LMPTHW - understanding the solution for ex8

@zedshaw
Since the video for ex8 is not published I have a questions regarding the provided solutions to ex8.

  1. As it’s written with sys.argv and not argparse, I understand that both delim and fields arguments are mandatory but without flags. Is it possible to add flags in case of sys.argv?

  2. In ex08_cut/cut.py there’s no argument for the file name but there is line = input(), what’s the correct input that should be given there?

  3. Why do you raise IndexError in the end of the file?

  4. When I run ex08_cut/cut.py then I get empty response, what am I doing wrong?
    Screenshot 2020-04-17 at 11.07.38

  5. I also get an empty response when run the second version ex08_cut/cut_fp.py.

  6. If I run it with 3 arguments like the unix cut command, I get ValueError: too many values to unpack (expected 3) so obviously the data-file argument is too much, but how can i feed the data argument to the command in this case?

Thank you for the help! :slight_smile:

The video is there, it’s just at the end of the list. They’re badly sorted.

I see I was searching for Ex08 but it’s titled Ex8

Aha! Alright I’ll have to fix that up soon. Let me know if you still have these questions after the video.