[Tutor] pointers
Bernard Lebel
3dbernard at gmail.com
Wed Jan 11 17:17:40 CET 2006
Hi Burge,
You can access command line argument via sys.argv:
import sys
print sys.argv
This prints a list of the command line arguments. Since argv is a
list, it means you can check its length to get the argument count:
print len( sys.argv )
There is always at least one argument in this list, if no argument was
supplied, then you get an empty string.
Hope this helps
Bernard
On 1/11/06, Burge Kurt <burge.kurt at gmail.com> wrote:
> Sorry for the previous message I did it by mistake..
> the function was like below:
>
> void get_args(int argc, char* argv[], Argument* args)
> {
> //check the amount of the arguments
> if(argc%2 == 0)
> {
> printf("Error, incorrect argument numbers : %d\n",argc);
> print_help();
> exit(1);
> }
>
> .....
> .........
> }
>
> My first question about the pointers here; how can I convert them to Python?
>
> And second and may be a little stupid; do I need to define argc how can I
> get arguments in python ?
>
> Thanks in advance,
>
> Burge
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>
More information about the Tutor
mailing list