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

  • Home
  • SEARCH
  • 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 7278495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:52:56+00:00 2026-05-28T22:52:56+00:00

I am learning Python and am reading through an example script that includes some

  • 0

I am learning Python and am reading through an example script that includes some variable definitions that look like:

output,_ = call_command('git status')
output,_ = call_command('pwd')

def call_command(command):
    process = subprocess.Popen(command.split(' '),
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE)
    return process.communicate()

If I print output I get the resulting shell output strung together, so I know it’s concatenating the variables. But I can’t find any reference to the ,_ convention in any of the docs. Can someone explain it to me so that I know for sure I am using it correctly?

  • 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-05-28T22:52:57+00:00Added an answer on May 28, 2026 at 10:52 pm

    The general form

    a, b = x, y
    

    is tuple assignment. The corresponding parts are assigned, so the above is equivalent to:

    a = x
    b = y
    

    In your case, call_command() returns a tuple of two elements (which is what process.communicate() returns). You’re assigning the first one to output and the second one to _ (which is actually a variable name, typically used to name something when you don’t care about the value).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was just reading through Learning Python by Mark Lutz and came across this
I am learning Python, and I have written a script per an example in
I've been learning python for a while now with some success. I even managed
I was learning python using the tutorial that comes with the standard python installation.
Hi I recently started experimenting with python currently reading Think like a computer scientist:
I've just started learning Python today. I've been reading a Byte of Python. Right
I am learning Python using Dive Into Python 3 book. I like it, but
I just started learning Python... I am writing a simple program that will take
I am learning python, now, i came across a code snippet which looks like
I'm learning Python. I'd like to do the following task: Input: a list: e.g.,

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.