Run a python program

4

How can I run a python script just by typing in console #run < problem_file.in with problem_file.in any document.

I now execute my program with cat input | python a_star_incons.py being input that document that mentioned them.

I'm using linux with python 2.7.6 [GCC 4.8.2]

    
asked by Ana Gonzalez 04.10.2016 в 01:13
source

1 answer

4

I see two ways to do it:

python a_star_incons.py < problem_file.in

Or that your script has execution permissions and execute it like this:

./a_star_incons.py < problem_file.in

I suggest you check your script, and maybe you could make it handle the input of the file as a parameter in the execution of the same script, and that for example, you throw an error message when you do not pass the name of the file . The idea is that the execution is:

./a_star_incons.py  problem_file.in
    
answered by 04.10.2016 / 17:49
source