It suggested that you use IPython shell instead of Bash/Zsh shells. Please refer to IPython Is the Best Shell for detailed discussions. If you have to use shell commands, it is suggested that you use Linux commands when possible as Linux command are more universal and useful. You can …
Hands on the Python module subprocess
General Tips¶
The method
subprocess.run
is preferred over older high-level APIs (subprocess.call
,subprocess.check_call
andsubprocess.check_output
). The methodsubprocess.Popen
(which powers the high-level APIs) can be used if you need advanced controls. When running a shell command usingsubprocess.run
,Avoid using system shell (i.e., avoid using
shell=True
) for 2 reasons. First, avoid shell injection attack. Second, there is no need for you to manually escape special characters in the command.
Managing Virtual Environments in Poetry
Where to Create Virtual Environments
By default,
Poetry create virtual environment in $HOME/.poetry
for cahcing/sharing purpose.
However,
it is inconvenient if you use Docker-based web IDE for a Python project
as you will lose the created virtual environment once the Docker container is restarted.
In that situation,
you …
Special Characters to Avoid in Strings
This articles talks about special characters to avoid in various places. You might not encounter issues most of the time when violating rules stated below, however, you never know when things will break. It is more for a good-practice suggestion.
String for Shell
- When you pass parameters from one program …
Useful Plugins for Eclipse
Terminal Plug-in
"Terminal Plug-in" is a fully-working command-line terminal for Eclipse.
EasyShell
"EasyShell" allows to open a shell window or file manager from the popup menu in the navigation tree or editor view.
Vrapper
Vrapper provides Vim-like scheme for Eclispe. You can edit code similar as what you do in …
Advanced Use of "head" and "tail"
It is suggested that you use Python instead of Shell to manipulate text files!!
Besides passing an unsigned integer as parameter to the option -n
,
you can also pass a signed integer to it.
When a signed integer is passed to -n
,
it means from/to (inclusive/exclusive similar to …