Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Quick and dirty in iPython to get you going.</p> <pre><code>In [1]: import os In [2]: cwd = os.getcwd() In [3]: files = os.listdir(cwd) In [4]: files Out[4]: ['Hello.taskpaper', 'My Todos.taskpaper', 'Tips &amp; Tricks.taskpaper'] In [5]: os.stat(cwd) Out[5]: posix.stat_result(st_mode=16877, st_ino=393413, st_dev=16777217L, st_nlink=5, st_uid=501, st_gid=20, st_size=170, st_atime=1388431093, st_mtime=1362280774, st_ctime=1362280774) In [6]: for f in files: ...: Display all 324 possibilities? (y or n) ...: ...: print os.stat(f) ...: posix.stat_result(st_mode=33188, st_ino=406919, st_dev=16777217L, st_nlink=1, st_uid=501, st_gid=20, st_size=437, st_atime=1387857115, st_mtime=1341158105, st_ctime=1345503808) posix.stat_result(st_mode=33188, st_ino=405425, st_dev=16777217L, st_nlink=1, st_uid=501, st_gid=20, st_size=238, st_atime=1387857115, st_mtime=1350748953, st_ctime=1350783773) posix.stat_result(st_mode=33188, st_ino=414444, st_dev=16777217L, st_nlink=1, st_uid=501, st_gid=20, st_size=2560, st_atime=1387857115, st_mtime=1341158105, st_ctime=1345503292) </code></pre> <p>To see files in a subdirectory, pass in the subdirectory from the list. In my example, fsys is an empty directory. See below:</p> <pre><code>In [1]: import os In [2]: cwd = os.getcwd() In [3]: files = os.listdir(cwd) In [4]: files Out[4]: ['fsys', 'Hello.taskpaper', 'My Todos.taskpaper', 'Tips &amp; Tricks.taskpaper'] In [5]: files_fsys = os.listdir(files[1]) --------------------------------------------------------------------------- OSError Traceback (most recent call last) &lt;ipython-input-5-7ca409829c27&gt; in &lt;module&gt;() ----&gt; 1 files_fsys = os.listdir(files[1]) OSError: [Errno 20] Not a directory: 'Hello.taskpaper' In [6]: files_fsys = os.listdir(files[0]) In [7]: files_fsys Out[7]: [] </code></pre> <p>Now, to be clear, this is quick-and-dirty. You'd probably not hard-code the indices of the list that you're trying to access.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload