0
How i can get output in variable from os module
I want take the output of os module on windows, for exemple : os.System("dir") I want take the output of "cmd > dir" and assign it to variable. For another use.??
3 Réponses
+ 1
Oh and most languages have a way to do this without using cmd or another shell. For example python has the "os" library and you can use "os.listdir" to get the contents out a directory
0
Not sure what language you are using. But I can tell you that if you do "> [file]" after a cmd command you can output it to a file then you could read the file and parse the data
0
Thanks to answer, i am using Python3, os module not do the job, or maybe i dont know how, so i use command tasklist and i want to get output, i know this method to write the output into file then get it, but that take so much memory, i am looking for a method to get output directly from command