0

I'm trying to write a script that gathers a certain type of file from a data folder, opens all of them in their default program (called iNMR) and processes them with different mathematical functions, gather some values, and record those in a text file.

Right now i'm just trying to focus on opening all of the files.

Here's what I have so far:

import os
import glob
import subprocess

os.chdir("/Users/BabyJ/Desktop/MRSDATA")
reflist = glob.glob('*raw_ref.SDAT')
actlist = glob.glob('*raw_act.SDAT')

for i in reflist:
    open('%r') %i

for i in actlist:
    open('%r') %i

Yes I want to open all of the files at once, but I'm not too sure of the syntax of open(). I need to open the file as if I were double clicking the file, but i'm pretty sure it only opens it in the python background or whatever it is so that I can edit it. But I need to do physical clicks on it, so I need it open physically.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Johnny Mai
  • 39
  • 1
  • 4

1 Answers1

0

You are attempting to open the file in python, while what you want is to open the file in whatever operating system you are running.

This is done through the os.system.

Here are similar questions with examples: click me and and me

Community
  • 1
  • 1
cdbitesky
  • 1,390
  • 1
  • 13
  • 30