stupid perl question

2006-05-26 Thread M.N.A.Smadi
hi guys; sorry for sending a perl question here, but python guy "HAD TO" look at perl code; how can i split a string that contains white spaces and '_' any clue? thanks moe smadi -- http://mail.python.org/mailman/listinfo/python-list

searching for the number of occurences of a string

2006-03-05 Thread M.N.A.Smadi
hi; say i have a text file with a string ( say '(XYZ)') and I want to find the number of line where this string has occured. What is the best way to do that? what about if that string was say a 0 with leading and trailing white spaces, would that be any different? thanks moe smadi -- http://m

Posix return or exit

2005-10-05 Thread M.N.A.Smadi
hi; my script must return codes which are based on the POSIX spec of returning a positive value. A work perl version of my code uses exit(code_num). I am not sure if the equivilant in python is also: exit(code_num) or return code_num any ideas? thanks moe smadi -- http://mail.python

Re: python getopt functionality

2005-10-03 Thread M.N.A.Smadi
moe smadi Fredrik Lundh wrote: >"M.N.A.Smadi" wrote: > > > >>I have a perl script that I need to port to python. The script takes >>input from the command line. Is there a standard way of processing >>command line arguments based on the -flag preceeding the

python getopt functionality

2005-10-03 Thread M.N.A.Smadi
hi; I have a perl script that I need to port to python. The script takes input from the command line. Is there a standard way of processing command line arguments based on the -flag preceeding the argument? thanks moe smadi -- http://mail.python.org/mailman/listinfo/python-list

Re: attribute error

2005-09-29 Thread M.N.A.Smadi
AttributeError: 'str' object has no attribute 'pop' Mike Meyer wrote: >In <[EMAIL PROTECTED]>, M.N.A.Smadi <[EMAIL PROTECTED]> typed: > > >>HI; >> >>I am having the following error: >> >>AttributeError: 'str&#x

Re: attribute error

2005-09-29 Thread M.N.A.Smadi
command', argv[2]) def execute_action(manager, argv): method_name = argv.pop(0).lower() but i always thought that something like this will be standard stuff. Any ideas? Mike Meyer wrote: >"M.N.A.Smadi" <[EMAIL PROTECTED]> writes: > > > >>HI; >>

attribute error

2005-09-26 Thread M.N.A.Smadi
HI; I am having the following error. I am using someone else's code and all they are doing is pass an argv to a function then def execute_action(manager, argv): method_name = argv.pop(0).lower() and am getting this strange error. AttributeError: 'str' object has no attribute 'pop' am us

mailing from with python

2005-09-20 Thread M.N.A.Smadi
hi; if i want to send a mail message using the "mail" client on a machine that has smtp protocol is there an easy way (i.e. like bash where you would just type mail -s SUBJECT message RECIPIENT) to do it from a python script? thanks moe smadi -- http://mail.python.org/mailman/listinfo/python-l

testing a website from python

2005-09-20 Thread M.N.A.Smadi
hi; I just want to test that a given website is up or not from a python script. I thought of using wget as an os command. Any better ideas? thanks moe smadi -- http://mail.python.org/mailman/listinfo/python-list

pinging from within python

2005-09-11 Thread M.N.A.Smadi
hi; I need a simple script to run the ping command with some parameters and be able to read the return value of the ping function. Any pointers will be appreciated thanks m.smadi -- http://mail.python.org/mailman/listinfo/python-list

time string conversion

2005-07-19 Thread M.N.A.Smadi
hi; i have a string that look like 16:23:20.019519 (i.e. system time) without days and months. I want to convert it to just one long floating point number with as many decimal places as possible. is there a funciton to do that? thanks ms -- http://mail.python.org/mailman/listinfo/python-lis

ethereal parser

2005-06-28 Thread M.N.A.Smadi
hi; i am looking for 802.11 prism header parser for an ethereal text dump. any body aware of something like already in place? thanks m.smadi -- http://mail.python.org/mailman/listinfo/python-list

Re: running programs from within python

2005-03-09 Thread M.N.A.Smadi
7;os' is not defined smadi Steven Bethard wrote: M.N.A.Smadi wrote: am getting an error in the script as follows: NameError: global name 'os' is not defined however i dont get the same error when running from the python CLI. (and yes i am importing the os module) Can you give

Re: running programs from within python

2005-03-09 Thread M.N.A.Smadi
hard wrote: M.N.A.Smadi wrote: M.N.A.Smadi wrote: hi; in general: how can i pass a string containing a concatenated sequcne of command line arguments to a unix system CLI? i guess i will answer myself: import os os.system(string) Also worth noting is that if you're using Python 2.4, you might want

Re: running programs from within python

2005-03-09 Thread M.N.A.Smadi
M.N.A.Smadi wrote: hi; in general: how can i pass a string containing a concatenated sequcne of command line arguments to a unix system CLI? my specific problem: i have an executable that is called xyz (written in C if that matters) that i cannot modify, which prints it is text output to the

running programs from within python

2005-03-09 Thread M.N.A.Smadi
hi; in general: how can i pass a string containing a concatenated sequcne of command line arguments to a unix system CLI? my specific problem: i have an executable that is called xyz (written in C if that matters) that i cannot modify, which prints it is text output to the screen and takes an i

running a C program with python script

2005-03-08 Thread M.N.A.Smadi
hi; how can i do the following: 1- run a C program from a python script 2- pass that C program an argument 3- Read the out of the program into a buffer that is local to the script thanks m.smadi -- http://mail.python.org/mailman/listinfo/python-list

firefox python plugin

2005-03-08 Thread M.N.A.Smadi
hi; i want to write a script to do the following: when using firefox to download a textfile, instead of saving it to the hard dist, i want to run a python script on it, and i want the python script then to prompt me for the location where i want to store the processed downloaded file any help i

global variables

2005-03-07 Thread M.N.A.Smadi
hi; i have a project with multiple files in it. I need to have a varaible that will contain a value that will be modified in one file, and when coming back to the same file it should retain the same value. The way am doing it right now, python is complaining about the variable being non-glob

enum question

2005-03-04 Thread M.N.A.Smadi
does python support a C-like enum statement where one can define a variable with prespesified range of values? thanks m.smadi -- http://mail.python.org/mailman/listinfo/python-list

substring matching

2005-03-02 Thread M.N.A.Smadi
hi; say i have the following variable data="""XYZ dflsjdfkl sdfsdhfl jdsflkdsjf sldjfsldjf """ i need to make sure that the first part is actually XYZ, is there an easy way of doing that? thanks m.smadi -- http://mail.python.org/mailman/listinfo/python-list