Moving from perl to python: questions

Gerrit Holl gerrit.holl at pobox.com
Wed Feb 16 10:17:16 EST 2000


David R. Favor wrote on 950685309:
> I'm moving from perl to python.

Good!

> Attached is a simple snippet of code that I'm having trouble with.

I do not see any attachement, sorry.

> Questions:
> 
>   1) Best way to convert array argv[1:] into string to pass functions

You are looking for the 'join' function from the 'string' module:

http://www.python.org/doc/current/lib/module-string.html#l2h-526

Please note that sys.argv is a list, not an array. I don't know about
Perl, but in Python, those are two different things (there is an
array module, too).

>   2) How to implement a no-frills file slurp() function

What does the 'slurp' function do?
For file methods, look at:

http://www.python.org/doc/current/lib/bltin-file-objects.html

regards,
Gerrit.

-- 
Homepage: http://www.nl.linux.org/~gerrit
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O
!M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth




More information about the Python-list mailing list