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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:25:04+00:00 2026-05-22T11:25:04+00:00

this very simple code is driving me nuts. import sys,string,socket maquina = sys.argv[1] texto

  • 0

this very simple code is driving me nuts.

import sys,string,socket  

maquina = sys.argv[1]
texto = string.join(sys.argv[2:], " ")
print '['+maquina+']' 
print '['+texto+']'

mysock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
if  maquina == '*':
    for ip in range(18,254):
        mysock.sendto( texto, ('192.168.0.'+str(ip),8090) )
else:
    mysock.sendto( texto, (maquina,8090))
mysock.close()

When I type

python send.py 192.168.0.135 several strings 

the output is:

[192.168.0.135]
[several strings]

But if I type

python send.py * several strings

I got:

[ajax]
[ajustaprofile.py build dia2django.py djangoajax django-cube django-evolution django_excel_templates-0.1 Doc google_appengine httpd.conf imagens jre1.5.0_08 lib list_mailbackup.py luma models.py netsend.py pip-log.txt reverse.py share testparamet.py tnsnames.ora util virttool-0.1 xlrd-0.7.1 xlutils-1.4.1 xlwt-0.7.2 several lines]

This is the file list that I have on current directory!
Python translates somehow ‘*’ to the files of current directory.

I tried to do the homework using this link but I got no clue.

http://docs.python.org/library/sys.html
http://www.faqs.org/docs/diveintopython/kgp_commandline.html

How can I use “*” on argv ?

  • 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-22T11:25:04+00:00Added an answer on May 22, 2026 at 11:25 am

    Try using '*' instead of *. Your shell feeds results of * to the program via cmdline args, just like ls *.

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

Sidebar

Related Questions

This very simple code gives me tons of errors: #include <iostream> #include <string> int
i am trying to compile this very simple piece of code class myList {
I have a very simple code snitppet that looks like this: <asp:Label Text=$Name$ runat=server
I have this very simple code or at least i think it's simple. //
This is most def something very simple, but it is driving me crazy, cant
I am getting the proverbial knickers in a twist. For this very simple code:
This is interesting. The attached very simple code gives nice 'background highlighted' text in
I have some very simple sample code like this: $.ajax({ url: 'demo2.htm', success: function(loadeddata){
I have some very simple sample code like this: $.ajax({ url: 'demo2.htm', success: function(loadeddata){
This problem is driving me up the wall. This is for a very simple

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.