Existe uma maneira de obter um carimbo de data / hora local no meu prompt do IPython?
Existe uma maneira de obter um carimbo de data / hora local no meu prompt do IPython? Estou usando o IPython 0.10 e o Python 2.6 no Windows Vista de 64 bits.
Meu prompt padrão atual é
[C:Python26/Scripts]
|9>
OK, tentei seguir suas instruções exatamente. No entanto, minha experiência foi que toda a edição de configurações é melhor mantida ao meuipy_user_conf.py
. Para citar:
User configuration file for IPython (ipy_user_conf.py)
This is a more flexible and safe way to configure ipython than *rc files
(ipythonrc, ipythonrc-pysh etc.)
This file is always imported on ipython startup. You can import the
ipython extensions you need here (see IPython/Extensions directory).
Feel free to edit this file to customize your ipython experience.
Note that as such this file does nothing, for backwards compatibility.
Consult e.g. file 'ipy_profile_sh.py' for an example of the things
you can do here.
See http://ipython.scipy.org/moin/IpythonExtensionApi for detailed
description on what you could do here.
Então agora eu tenho essas linhas em main ():
# -- prompt
# A different, more compact set of prompts from the default ones, that
# always show your current location in the filesystem:
o.prompt_in1 = r'\C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Normal\n\C_Green|\#>'
o.prompt_in2 = r'.\D: '
o.prompt_out = r'[\#] '
E eu entendo isso, por exemplo:
16:49:50 In[9]:1/7
1 [9] 0.14285714285714285
16:50:09 In[10]:
Questões:
O que é isso1
?Como posso manter o diretório atual no prompt? Antes eu tinha
[C:Python26/Scripts]
|8>
Mais uma vez com sentimento. Sinto muito pela bagunça que fiz. Preciso relatar as linhas que adicionei ou modifiquei são:
import_all("os sys random datetime")
o.prompt_in1 = r'\C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Normal\n\C_Green|\#>'
o.prompt_in1 = r'${datetime.now().strftime("%H:%M:%S")}[\#]:'
o.prompt_out = r'[\#] '