string = "Deepika Padukone, Esha Gupta or Yami Gautam - Who's looks hotter and sexier? Vote! - It's ... Deepika Padukone, Esha Gupta or Yami Gautam…. Deepika Padukone, Esha Gupta or Yami Gautam ... Tag: Deepika Padukone, Esha Gupta, Kalki Koechlin, Rang De Basanti, Soha Ali Khan, Yami ... Amitabh Bachchan and Deepika Padukone to be seen in Shoojit Sircar's Piku ..."
fp = open("test.txt", "w+");
fp.write("%s" %string);
dopo aver eseguito il codice sopra Ho il seguente errore.Come eliminare l'errore di codifica ascii in python
File "encode_error.py", line 1
SyntaxError: Non-ASCII character '\xe2' in file encode_error.py on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
Hai * letto il link fornito *? –
Funziona bene per me ... – hd1
@ hd1: Davvero? In un file sorgente, quindi esegui con Python 2? * Non limitarti a incollarlo in una sessione Python interattiva *. –