module funcwin.default_functions

Short summary

module tkinterquickhelper.funcwin.default_functions

various basic functions often needed

source on GitHub

Functions

function

truncated documentation

_clean_name_variable

Cleans a string.

_get_format_zero_nb_integer

file_grep

Grep.

file_head

Keeps the head of a file.

file_list

Prints the list of files and sub files in a text file.

file_split

Splits a file.

is_empty_string

Tells if a string is empty.

IsEmptyString

Tells if a string is empty.

test_regular_expression

Tests a regular expression.

Documentation

various basic functions often needed

source on GitHub

tkinterquickhelper.funcwin.default_functions.IsEmptyString(s)[source]

Tells if a string is empty.

Parameters

s – string

Returns

boolean

source on GitHub

tkinterquickhelper.funcwin.default_functions._clean_name_variable(st)[source]

Cleans a string.

Parameters

st – string to clean

Returns

another string

source on GitHub

tkinterquickhelper.funcwin.default_functions._get_format_zero_nb_integer(nb)[source]
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

source on GitHub

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

source on GitHub

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

source on GitHub

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 streams

  • header – consider a header or not

  • rnd – randomly draw the file which receives the current line

Returns

number of processed lines

source on GitHub

tkinterquickhelper.funcwin.default_functions.is_empty_string(s)[source]

Tells if a string is empty.

Parameters

s – string

Returns

boolean

source on GitHub

tkinterquickhelper.funcwin.default_functions.test_regular_expression(exp='.*', text='', fLOG=<function fLOG>)[source]

Tests a regular expression.

Parameters
  • exp – regular expression

  • text – text to check

  • fLOG – logging function

source on GitHub