http://guyingbo.iteye.com/blog/111141
ipython 不光可以执行 shell 命令,还可以把 shell 和 python 脚本混用。我当前目录下有 1.Wma 到 80.Wma 需要重命名为小写的 1.wma 到 80.wma,可以这么做:
files = !ls for f in files: !mv $f $f.lower()
解释一下: ! 代表执行的 shell 命令,$ 代表以 python 字符串到 shell 字符串的转换。!ls 执行命令的结果