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 9098241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:18:54+00:00 2026-06-17T00:18:54+00:00

using module sys one can get command line arguments like this import sys for

  • 0

using module sys one can get command line arguments like this

import sys
for x in sys.argv:
    print x

then at command shell[ubunto]

>>python file.py 1, 2, 3

this will print
file[filename]
1
2
3
Now comes my doubt
in python documentaion 3.0.1 it is mentioned that

If no script name was passed to the Python interpreter, argv[0] is the empty string.

>>python  1, 2, 3

if i pass no script name , it will lead to error that ‘can’t open a file’. How would argv[0] be intitialized to an empty string when you are not passing script name ?

  • 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-17T00:18:55+00:00Added an answer on June 17, 2026 at 12:18 am

    In the shell, you can do something like python -c "print 'Hello World!'", or you can put source code into python through a pipe. In such cases, no filename is available for python. In all other cases, Python will have a filename. Even if you use a shebang-line:

    #! /usr/bin/python
    

    and then call

    ./file.py 1, 2, 3
    

    the shell will translate it to the correct interpreter call

    python file.py 1, 2, 3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I read an excel file without using any module? I tried like just
Using Python module re, how to get the equivalent of the \w (which matches
I am using logging module of python. How can I access the handlers defined
I have seen this question answered in reference to Bash, but can't find one
I'm having a module import issue. using python 2.6 on ubuntu 10.10 I have
when using the module pattern in js i've notice that the main benefits are
I am currently using c(module_name) to build my Erlang files one by one. How
I'm using the module simplenews and during the registration process it reads Select the
I am using booking module in my Magento store. All works fine before a
I've compiled a Python module using my own Qt4 library located in ~/opt/qt-4.6.0/ ,

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.