Ciao, Il giorno 28 giugno 2017 09:51, Gabriele Battaglia <iz4...@libero.it> ha scritto:
> Salve. > Se ho una lista: > l=['a','b','c'] > E desidero eliminare l'elemento 'b', ma voglio cercarlo per indice, non > per valore, invece di usare l.remove('b') devo usare l.pop(1). > La domanda è: per evitare che pop stampi a schermo il valore rimosso, > l'unico modo è quello di assegnarlo ad una variabile o esiste un modo per > non far produrre output a pop? > > gc = l.pop(1) > 'b' > immagino tu stia vedendo la stampa a schermo perchè stai eseguendo quella riga di codice dall'interprete interattivo che di solito stampa il risultato dell'ultima operazione, lanciando invece uno script contente quel codice questo non dovrebbe succedere a meno che tu non lo faccia esplicitamente con una print -- "Unix IS user friendly. It's just selective about who its friend are" "Nevertheless I still think it’s a bad idea to make things harder for ourselves if we can avoid it." "C is quirky, flawed, and an enormous success." -- Dennis Ritchie "Shipping is a feature. A really important feature. Your product must have it." "There is no such a thing as a temporary change or workaround: In most cases, workarounds are tech debt." "La gatta frettolosa ha fatto i gattini ciechi"
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python