2008/3/26, Mattia <[EMAIL PROTECTED]>: > mi sono da poco avvicinato a questo linguaggio. > Mi sono imbattuto in questo penso banale problema che non riesco a > risolvere: > > f = open('/etc/hostname', 'r') > hostname = f.readline() > f.close()
Il strip() cancela il \n, spaces, and tabs: >>> "foobar\n".strip() 'foobar' Anche puoi fare: >>> "foobar\n"[:-1] 'foobar' (io preferisco il strip) Saluti! -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python