44 ms·
file_list = !ls So much nicer than messing around with subprocess and pipes.
by sixhobbits 10y ago
file_list = !ls
So much nicer than messing around with subprocess and pipes.
- thomasahle 10y agoWait, what is the syntax for this? I can't do `len(!ls)`?
- carreau 10y agoNo, `!command` only work on assignment. Please read http://ipython.readthedocs.io/en/stable/interactive/tutorial.html http://ipython.readthedocs.io/en/stable/interactive/tutorial... See tutos like https://www.youtube.com/watch?v=xe_ATRmw0KM https://www.youtube.com/watch?v=xe_ATRmw0KM , most of what works in the notebook work in IPython. But yes you can do things like: files = ! ls *.txt for name in files: with open(name) as f: if 'Content-Type: text/x-rst' in f.read(): !git mv {name} {name[:-3]}rst