擅长:python、mysql、java
<p>试试这个:</p>
<pre><code>>>> import sys
>>> import random
>>> class RandomPrompt(object):
... prompts = 'hello >', 'hi >', 'hey >'
... def __repr__ (self): return random.choice(self.prompts)
...
>>> sys.ps1 = RandomPrompt()
hello >1
1
hi >2
2
</code></pre>