So here is my dir structure
Project
-Sub
--401.nii.gz
--xx.bval
-Sub2
--401.nii.gz
--xx.bval
-Sub3
--401.json
--xx.bval
-Sub4
--401.json
--xx.bval
etc
Here is the code
import os
PATH = "/Users/diabetesgp/Desktop/Analysis/HV"
for root, subFolder, files in os.walk(PATH):
for item in files:
if item.endswith("401.json") or item.endswith("401.nii.gz"):
jsonnii = os.path.join(root,item)
if item.endswith(".bval"):
bval = os.path.join(root, item)
print(jsonnii+bval)
I want to concatenate these two string in a linux command. As you can see i'm trying to get a variable out of the first loop so i can use two different searches and later run a command line. How can i do this? In c# which i'm most familiar with we do jsonnii = null before the if statement. I tried setting jsonnii =None and =0 still no joy. Please help. Thank you.
Aucun commentaire:
Enregistrer un commentaire