Browse Source

Added a couple more instructions.

dev
Franco Masotti 2 years ago
parent
commit
208ef35520
Signed by: frnmst
GPG Key ID: 24116ED85666780A
  1. 4
      _posts/2020-07-14-python-3-cheatsheet.md

4
_posts/2020-07-14-python-3-cheatsheet.md

@ -1,7 +1,7 @@
---
title: Python 3 cheatsheet
tags: [python3, python, cheatsheet]
updated: 2020-07-14 11:12
updated: 2020-07-21 17:58
description: A series of instructions in Python I use frequently on several projects
---
@ -43,3 +43,5 @@ This is a list of instructions I use frequently in:
| get last path component from url | `pathlib.Path(urllib.parse.urlsplit(url: str).path).name` | `import pathlib, urllib` |
| get relative path | `pathlib.Path(shlex.quote(path: str)).name` | `import pathlib, shlex` |
| get full path | `str(pathlib.Path(shlex.quote(directory: str), shlex.quote(file: str)))` | `import pathlib, shlex` |
| remove file extension | `pathlib.Path(shlex.quote(path: str)).stem` | `import pathlib, shlex` |
| get file extension | `pathlib.Path(shlex.quote(path: str)).suffix` | `import pathlib, shlex` |

Loading…
Cancel
Save