[SP-pm] [OT] O cara mudou para python e teve que escrevar mais ...

Solli Honorio shonorio em gmail.com
Sexta Dezembro 29 05:27:11 PST 2006


Pessoal isto é completamente fora da lista, e nem sei se é ético, mas
achei interessante este caso.

Abraços,

Solli M. Honório

Mike Cariaso:
>* After moving from perl to python I find I miss the ability to do a
*>*
*>*                  while (<>) { }
*
Look at 'fileinput' in the standard library.

However, using it will be slower than using, say

try:
   args, filenames = getopt.getopt ...
except getopt.error:
   ...

if not filenames:
   filenames = ["-"]

for filename in filenames:
   if filename == "-":
     infile = sys.stdin
   else:
     infile = file(filename)
   for line in infile:

     ...
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://mail.pm.org/pipermail/saopaulo-pm/attachments/20061229/2de0e132/attachment.html 


Mais detalhes sobre a lista de discussão SaoPaulo-pm