Tell me, please, how to transfer and process the file name in a program written in Python?
For example: python text.txt program.py

  • Google in the direction of the module argparse - Allespro

1 answer 1

The easiest way:

 import sys print(sys.argv[1]) 

And pass the argument when running the script:

 python program.py text.txt 
  • Thank you, figured out :) - Nikita T