module funcwin.default_functions
¶
Short summary¶
module tkinterquickhelper.funcwin.default_functions
various basic functions often needed
Functions¶
function |
truncated documentation |
---|---|
Cleans a string. |
|
Grep. |
|
Keeps the head of a file. |
|
Prints the list of files and sub files in a text file. |
|
Splits a file. |
|
Tells if a string is empty. |
|
Tells if a string is empty. |
|
Tests a regular expression. |
Documentation¶
various basic functions often needed
- tkinterquickhelper.funcwin.default_functions.IsEmptyString(s)[source]¶
Tells if a string is empty.
- Parameters:
s – string
- Returns:
boolean
- tkinterquickhelper.funcwin.default_functions._clean_name_variable(st)[source]¶
Cleans a string.
- Parameters:
st – string to clean
- Returns:
another string
- tkinterquickhelper.funcwin.default_functions.file_grep(file='', regex='.*', out='', head=-1)[source]¶
Grep.
- Parameters:
file – file name
regex – regular expression
out – output file, if == None or empty, then, it becomes: file + “.head.%d.ext” % head
head – stops after the first head lines (or -1 if not stop)
- Returns:
out
- tkinterquickhelper.funcwin.default_functions.file_head(file='', head=1000, out='')[source]¶
Keeps the head of a file.
- Parameters:
file – file name
head – number of lines to keep
out – output file, if == None or empty, then, it becomes: file + “.head.%d.ext” % head
- Returns:
out
- tkinterquickhelper.funcwin.default_functions.file_list(folder, out='')[source]¶
Prints the list of files and sub files in a text file.
- Parameters:
folder – folder
out – result
- Returns:
out
- tkinterquickhelper.funcwin.default_functions.file_split(file='', nb=2, out='', header=False, rnd=False)[source]¶
Splits a file.
- Parameters:
file – file name or stream
nb – number of files
out – output file, if == None or empty, then, it becomes:
file + ".split.%d.ext" % i
, it must contain%d
or it must a a list or strings or streamsheader – consider a header or not
rnd – randomly draw the file which receives the current line
- Returns:
number of processed lines
- tkinterquickhelper.funcwin.default_functions.is_empty_string(s)[source]¶
Tells if a string is empty.
- Parameters:
s – string
- Returns:
boolean