[Python] errore(=) in esempio pubblicato nel gruppo

Carlos Catucci carlos.catucci a gmail.com
Ven 23 Ago 2019 14:18:27 CEST


On Fri, 23 Aug 2019 at 14:08, antonio taccetti <antonio.taccetti a gmail.com>
wrote:
>
> Scusate la domanda banale, sono neofita di Python 3.7,
> sto provando il codice  della pagina
>
https://docs.python.org/3/library/email.examples.html?highlight=read%20mail
> First, let’s see how to create and send a simple text message (both the
text content and the addresses may contain unicode characters):
>
> Non riesco a capire perchè mi da l'errore:
> Traceback (most recent call last):
>   File
"C:\Users\leona\AppData\Local\Programs\Python\Python37\Tools\scripts\posta\lists-Creare-inviare-messaggio-di-testo.py",
line 13, in <module>
>     with open(textfile) as fp:
> NameError: name 'textfile' is not defined
> Il file c'è ed è bnella stessa cartella Cosè che non capisco?
> Dov'è che sbaglio?


textfile e' una variabile, o ci metti il nome del file o la inizializzi da
qualche parte con il nom del file che vuoi usare.
Il commento stesso dice

# Open the plain text file whose name is in textfile for reading.

In pratica textfile deve essere inizializzata con il nome del file

Carlos
--
EZLN ... Para Todos Todo ... Nada para nosotros
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.python.it/pipermail/python/attachments/20190823/caa442b6/attachment.html>


Maggiori informazioni sulla lista Python