Reputation: 367
In the python notebook I would like to pass the temp argument in the first line to the last line, but am not sure how to do that.
def grabdata(statefolders, temp, split_by):
for folder in statefolders:
sub = folder.split('_')[split_by]
new_name = sub + '_out.txt'
!cp {folder}/done/sigdet_output*out temp{new_name}
Upvotes: 0
Views: 98
Reputation: 31729
If
!cp {folder}/done/sigdet_output*out temp{new_name}
is what you would usually execute in your shell, the command in Python would be:
import subprocess
subprocess.run(["cp", "{}/done/sigdet_output*out".format(folder), "temp{}".format(new_name)])
Upvotes: 1