Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8071025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:34:13+00:00 2026-06-05T13:34:13+00:00

I am trying to run a command from Python script(using Popen()) get the output

  • 0

I am trying to run a command from Python script(using Popen()) get the output as list, instead of string.

For Example, When I use Popen(), it gives the output as string. For commands like “vgs, vgdisplay, pvs, pvdisplay”, I need to get the output as lists and should be able to parse it row and column, so that I can do the necessary action(like deleting the already existing Vg’s etc etc). I was just wondering, if it is possible to get as lists or atleast convert into lists….

I started learning python a week ago, so I might have missed some simple tricks, please pardon me…..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:34:14+00:00Added an answer on June 5, 2026 at 1:34 pm

    Just to elaborate on the existing comments

    from subprocess import PIPE
    import subprocess
    pro = subprocess.Popen("ifconfig", stdout=PIPE, stderr=PIPE)
    data = pro.communicate()[0].split()
    for line in data:
        print "THIS IS A LINE"
        print line
        print "**************"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run a shell command from within a python script which needs
I am trying to run a Django management command from cron. I am using
I'm trying to run a python script using python 2.6.4. The hosting company has
I am trying to run an awk script using python, so I can process
I'm trying to run a python script and capture the output of it. It
I'm trying to run a script from the commandline, and python is having absolutely
I'm trying to open a Python script from the Python command line. There's a
I'm trying to run a program from python and print the output based on
I'm trying to run various commands using psexec.exe from Windows Sysinternals . What I
I am trying to run a jar file using my command prompt (Windows XP)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.