Domande taggate «nonetype»


7
Come "testare" NoneType in Python?
Ho un metodo che a volte restituisce un valore NoneType. Quindi, come posso mettere in discussione una variabile che è NoneType? Devo usare il metodo if , per esempio if not new: new = '#' So che è sbagliato e spero che tu capisca cosa intendevo dire.
398 python  nonetype 



3
Python Nessuno confronto: dovrei usare "is" o ==?
Il mio editor mi avverte quando confronto my_var == None, ma nessun avviso quando lo uso my_var is None. Ho fatto un test nella shell Python e ho determinato che entrambe sono sintassi valide, ma il mio editor sembra dire che my_var is Noneè la preferita. È questo il caso …

7
TypeError: l'oggetto 'NoneType' non è iterabile in Python
Cosa significa errore TypeError: 'NoneType' object is not iterable? Lo sto ottenendo su questo codice Python: def write_file(data, filename): # creates file and writes list to it with open(filename, 'wb') as outfile: writer = csv.writer(outfile) for row in data: # ABOVE ERROR IS THROWN HERE writer.writerow(row)
145 python  nonetype 

9
Cos'è un oggetto "NoneType"?
Ricevo questo errore quando eseguo il mio script python: TypeError: cannot concatenate 'str' and 'NoneType' objects Sono abbastanza sicuro che "str" ​​significhi stringa, ma non so cosa sia un oggetto "NoneType". Il mio script cagiona sulla seconda riga, so che la prima funziona perché i comandi di quella riga sono …
89 python  null  nonetype 
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.