Trying to decide between PHP and Python
Google Poster
goposter at jonjay.com
Tue Jan 4 15:32:28 EST 2011
On Jan 4, 2:29 pm, Dan M <catd... at gmail.com> wrote:
> On Tue, 04 Jan 2011 12:20:42 -0800, Google Poster wrote:
> > About once a year, I have to learn yet another programming language.
> > Given all the recommendations (an outstanding accolade from Bruce Eckel,
> > author of "Thinking in Java") I have set my aim to Python. Sounds kinda
> > cool.
>
> > The indentation-as-block is unique, but that is how I always indent,
> > anyway.
>
> > Can any of you nice folks post a snippet of how to perform a listing of
> > the current directory and save it in a string?
>
> > Something like this:
>
> > $ setenv FILES = `ls`
>
> > Bonus: Let's say that I want to convert the names of the files to
> > lowercase? As 'tolower()'
>
> > TIA,
>
> > -Ramon
>
> 1)
> import os
> files = ' '.join(os.listdir('/home/dan'))
>
> 2)
> import os
> import string
> files = string.lower(' '.join(os.listdir('/home/dan')))
>
> As to choice between Python and PHP, I would say learn anything but PHP.
> Even Perl has fewer tentacles than PHP.
Not to mention that it took me 9 minutes to get a reply from you...
Quite speedy community support.
That is a very important parameter in my technology decisions these
days.
Thanks!
-Ramon
More information about the Python-list
mailing list