smpl.io
Simplified input and output.
|
Appends to file by string or writable |
|
Get all the files in |
|
Searches for |
|
Scientific number format. |
|
Creates the neccessary directories above |
|
Prints the passed |
|
Returns the path to the path of current file (in linux format). |
|
Reads the file |
|
Write to file by string or writable |
Functions
- smpl.io.append(destination, content, mode='a+')[source]
Appends to file by string or writable
destiantion.- destinationstr, writeable
destination to write to.
- contentstr
text to be written.
- modestr
mode to open the file. Default is ‘a+’ (append and read).
>>> append(sys.stdout,"hi") hi
- smpl.io.files(ending, folder='.')[source]
Get all the files in
folderending withending.- folderstr
folder name.
- endingstr
ending of the files.
- list
list of files.
>>> files(".py") [(0, 'setup', './setup.py')]
- smpl.io.find_file(fname, up=0)[source]
Searches for
fnamein all down folders or up folder to given order respectively.
- smpl.io.gf(i=3)[source]
Scientific number format.
- iint
Number of digits.
- str
Scientific number format string.
>>> gf(2) '{0:.2g}' >>> gf(2).format(789234578934) '7.9e+11' >>> gf(5).format(789234578934) '7.8923e+11'
- smpl.io.mkdirs(fn)[source]
Creates the neccessary directories above
fn.- fnstr
file name.
>>> mkdirs("test.out")
- smpl.io.pr(a, nnl=False)[source]
Prints the passed
a.- nnlbool
no-new-line
- aany
unchanged
a.
>>> 5 + pr(4) 4 9 >>> 5 + pr(4, nnl=True) 49
- smpl.io.pwd()[source]
Returns the path to the path of current file (in linux format).
- str
path to the path of current file.