Running a python program from jupyter notebook while passing filenames as arguments

3875 views python

I am trying to run a program named "" from jupyter notebook while passing multiple files as arguments to the program. My code is as follows:

for filename in all_csv_files:
    %run '' filename

Here, all_csv_files contains a list of all the CSV files in the current directory. This program takes filename as an argument.

Here, jupyter notebook considers filename as a string while I want it to consider the name stored in the variable 'filename' of the for loop. How do I do this?

answered question

1 Answer


Type this

!python all_csv_files

posted this

Have an answer?


Please login first before posting an answer.