subprocess - call command line from python class -


I have a class that takes a file, does a few processes, and output a tab-delimited file This output file needs to be sorted, the simplest way is the command line: sort -k1,1 -k2,2n -k3,3n

However, I want to apply it to Python class.

I tried:

  import the import file from the subprocess call # class, do something, output a file, name 'tmp_output' class ClassA (object): def __init __ (self, Tmp_input, tmp_output): self.tmp_input = tmp_input self.tmp_output = tmp_output Automatically (DSP_input) def (self, tmp_input) dop: outputfile = open (auto.tp_output, 'w') #dosomething #thing = ... outputfile #tmp_output # This output is a file that is used to sort the tmp_output class sort (object) Is used for: def __init __ (self, tmp_output, output): self.tmp_output = tmp_output self.output = output def sort (self): call ('sort-1q-2 -2,2 n- 3,3 N SRTMP_ Output> Self U. Tput ') # This step does not work  

My question is that To type-k1,1 -k2,2n -k3,3n to call, the output is taken as input and output is from the class variable.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -