Gibt es eine Möglichkeit, einen lokalen Zeitstempel in meiner IPython-Eingabeaufforderung abzurufen?
Gibt es eine Möglichkeit, einen lokalen Zeitstempel in meiner IPython-Eingabeaufforderung abzurufen? Ich verwende IPython 0.10 und Python 2.6 unter 64-Bit-Windows Vista.
Meine aktuelle Standardeingabeaufforderung ist
[C:Python26/Scripts]
|9>
OK, ich habe versucht, deinen Anweisungen genau zu folgen. Meine Erfahrung war jedoch, dass alle Konfigurationsbearbeitungen am besten auf meinem @ gehalten werdeipy_user_conf.py
. Um es zu zitieren:
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.
So habe ich jetzt diese Zeilen in 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'[\#] '
Und ich bekomme dies zum Beispiel:
16:49:50 In[9]:1/7
1 [9] 0.14285714285714285
16:50:09 In[10]:
Fragen
Was ist das1
?Wie kann ich das aktuelle Verzeichnis in der Eingabeaufforderung belassen? Vorher hatte ich
[C:Python26/Scripts]
|8>
inmal mehr mit Gefühl. Es tut mir so leid für das Durcheinander, das ich gemacht habe. Ich muss die Zeilen melden, die ich hinzugefügt oder geändert habe:
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'[\#] '