Formatting🍋
pretty_print(x, module='main')
🍋
Print any object in a (true) strip_extra_ws way, with nested attributes and functions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
object
|
the object to print. |
required |
module |
str
|
the module name for which to consider strip_extra_ws printing nested objects. Objects not belonging to that module will be printed according to their representation instead of strip_extra_ws. Defaults to "main" (i-e from REPL). |
'main'
|
strip_extra_ws(msg)
🍋
Remove all intermediate whitespaces in a message. Useful for printing messages and staying PEP8 compliant, e.g.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
msg |
str
|
string message to process. |
required |
Returns:
Type | Description |
---|---|
str
|
The string message without extra-spaces in the middle. |
Example
strip_extra_ws(f'''
my message
is awesome mister {name}
''')
will return
"my message is awesome mister {name}"
rather than
"my message
is awesome mister {name}"
Last update:
2022-01-06