7.20.1 Esempio

L'esempio seguente dimostra come usare le funzioni di lettura e scrittura sullo storico del modulo readline per caricare e salvare automaticamente i file dello storico chiamati .pyhist dalla home directory dell'utente. Il codice sottostante verrebbe normalmente eseguito automaticamente durante le sessioni interattive dal file PYTHONSTARTUP dell'utente.

import os
histfile = os.path.join(os.environ["HOME"], ".pyhist")
try:
    readline.read_history_file(histfile)
except IOError:
    pass
import atexit
atexit.register(readline.write_history_file, histfile)
del os, histfile
Vedete Circa questo documento... per informazioni su modifiche e suggerimenti.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy