Tips¶
- You can use Convert curl syntax to Python, Node.js, PHP, R or curlconverter to convert CURL commands to Python requests code.
The unpacking assignment assigns elements of a tuple/list to variables at once.
__file__
is the path of the Python script.
Note that if you make a sybolic link to a Python script and run the symbolic link,
then __file__
is the path of the symbolic link.
Of course, you can use os.path.realpath
to get real path of files.
pathlib.Path …
My first choice is pandas in Python. However, below are some tools for quick and dirty solutions.
q -t -H 'select c1, c3 from file.txt'
cut -d\t -f1,3 file.txt
awk -F'\t' '{print $1 "\t" $3}' file.tsv
Note: neither cut …
Get information of the staff
group.
$ getent group staff
staff:x:20:
Get group ID of the staff
group.
$ getent group staff | cut -d: -f3
20
Get information of the staff
group.
$ dscl . -read /Groups/staff
Get group ID of the staff
group.
$ dscl . -read /Groups/staff | awk …