Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [python] Problema gestione encoding

    Dall'autorevole "dive into python" leggo che per cambiare la gestione di Unicode occorre il codice:

    codice:
    import sys
    
    sys.setdefaultencoding('iso-8859-1')
    tuttavia mi appare un errore alquanto insolito:

    AttributeError: 'module' object has no attribute 'setdefaultencoding'

    Come dire, che la suddetta funzione non esiste proprio. E, in effetti, nella guida del mio python (versione 2.3.3) non è menzionata (tuttavia è menzionata la funzione sorella getdefaultencoding...)

    Che significa?
    PiKey
    got excited by ubuntu edgy eft
    www.pikkio.net/blog

  2. #2
    Utente di HTML.it L'avatar di Fox82
    Registrato dal
    Feb 2002
    Messaggi
    459
    codice:
    >>> print dir(module)
    ['__displayhook__', '__doc__', '__excepthook__', '__name__',
     '__stderr__', '__stdin__', '__stdout__', '_getframe', 
    'api_version', 'argv', 'builtin_module_names', 'byteorder', 
    'call_tracing', 'callstats', 'copyright', 'displayhook', 
    'exc_clear', 'exc_info', 'exc_type', 'excepthook', 
    'exec_prefix', 'executable', 'exit', 'getcheckinterval', 
    'getdefaultencoding', 'getdlopenflags', 
    'getfilesystemencoding', 'getrecursionlimit', 'getrefcount', 
    'hexversion', 'last_traceback', 'last_type', 'last_value', 
    'maxint', 'maxunicode', 'meta_path', 'modules', 'path', 
    'path_hooks', 'path_importer_cache', 'platform', 'prefix', 
    'ps1', 'ps2', 'setappdefaultencoding', 
    'setcheckinterval', 'setdlopenflags', 'setprofile', 
    'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout', 
    'version', 'version_info', 'warnoptions']
    Linux user number 403381

    Stop TCPA!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.