Information, development, tutorials, examples, documentation, career
Recursively reverse a string by Python
# During reversion, first char in string will become last one. Then if we have reversed version of the string (from 1 to last), then we know the result ! That is reverse(s[1:]) + s. Base case is when it is empty string, in which case we simply return empty string.
defreverse(s): ifnot s: return s return reverse(s[1:])+s
The .mysql_history file is internally used by the command line editiing utility program, called libedit. The file is not intended to be directly viewed, or edited etc.
The content of the file is encoded by wctomb. To view the content:
shell> cat ~/.mysql_history | python2.7 -c "import sys; print(''.join([l.decode('unicode-escape') for l in sys.stdin]))"
If your system has python 3.x installed, the command must be changed like below:
shell> cat ~/.mysql_history | python -c "import sys; print(*[l.decode('unicode-escape') for l in sys.stdin.buffer])"
MyCli History and Search
MyCli keeps track of the queries entered in the repl. Up/Down arrow can be used to navigate the history.
Pressing <C-r> will enable incremental history search. So press <C-r> and then start typing your search term to see the queries narrowed down. You can cycle through the matches by pressing <C-r> again.