LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 01-31-2005, 06:35 PM   #1
bendeco13
Member
 
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Rep: Reputation: 30
python read output from seperate script?


Does anyone know of a way to assign the output of a script/program to a variable in a python script?

I tried this:

text = execute("some_script")

but that didn't work....
Any ideas?

thanks in advance.
Bendeco
 
Old 02-01-2005, 11:38 PM   #2
bendeco13
Member
 
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Original Poster
Rep: Reputation: 30
O.k I figured it out
I had to do this:
Code:
import os
file = os.popen("myfile","r")
outputtxt = file.read()
file.close()
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script to read ps -e output and determine process double processes. dr_zayus69 Programming 1 09-21-2005 06:37 PM
python cgi script and premature end of script headers Neruocomp Programming 1 07-28-2005 12:43 PM
How do you output PCM sounds linux using python and ALSA? jjdb6185 Programming 1 07-13-2005 03:39 PM
How to compare records in two tables in seperate My Sql database using shell script sumitarun Programming 5 04-14-2005 10:45 AM
Send output to seperate terminals? Brain Drop Programming 3 02-25-2005 11:44 PM


All times are GMT -5. The time now is 01:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration