2014-06-26 19:12 GMT+02:00 Gabriele Battaglia <iz4...@libero.it>:

> Sera.
> Una questione semplice che, immagino, richiede una soluzione super
> semplice.
>
> s = ‘123’
> for j in range(3):
>     print s,
>
> L’output è:
>
> 123 123 123
>
> So che avrei potuto scrivere print s*3, ma non è questo il caso.
>
> Il problema è che non voglio quello spazio. Mi serve ottenere:
>
> 123123123
>
> Lo otterrei unendo le stringhe col “+”, ma non posso terminare la riga con
> +
>
> print s+
>
> perché si tratta di un synthax error.
>
> Come fare?
>


Così:


import sys
sys.stdout.write(s)

Ciao.
Marco.


-- 
http://beri.it/ - Un blog
http://beri.it/i-miei-libri/ - Qualche libro
_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a