argparse in
Python 2.7 doc |
Python 3.6 doc
import argparse
if __name__=='__main__':
parser = argparse.ArgumentParser()| git config --global alias.s status | |
| git config --global alias.b branch | |
| git config --global alias.db 'branch -d' | |
| git config --global alias.ddb 'branch -D' | |
| git config --global alias.fch fetch | |
| git config --global alias.co checkout | |
| git config --global alias.mg merge | |
| git config --global alias.cmt commit | |
| git config --global alias.l 'log --oneline --graph' | |
| git config --global alias.la 'log --oneline --graph --all' |
| # Check JAVA_HOME | |
| $null -ne $env:JAVA_HOME | |
| Test-Path $env:JAVA_HOME | |
| -not ($env:JAVA_HOME -match '\s+') | |
| # Check java.exe | |
| Test-Path $env:JAVA_HOME\bin\java.exe | |
| # Check javac.exe | |
| Test-Path $env:JAVA_HOME\bin\javac.exe |
| #Requires -RunAsAdministrator | |
| $menutext = "Open with Sublime Text 3" | |
| $sublime = "C:\Program Files\Sublime Text 3\sublime_text.exe" | |
| $for_files = "Registry::HKEY_CLASSES_ROOT\*\shell\$menutext" | |
| $for_dirs = "Registry::HKEY_CLASSES_ROOT\Directory\shell\$menutext" | |
| $for_background = "Registry::HKEY_CLASSES_ROOT\Directory\Background\shell\$menutext" | |
| foreach ($path in @($for_files, $for_dirs, $for_background)){ | |
| $placeholder = if ($path -eq $for_files) {"%1"} else {"%V"} |
| # Python & Jupyter Notebook | |
| *.pyc | |
| .ipynb_checkpoints/ | |
| __pycache__/ | |
| # ArcGIS | |
| *.gdb | |
| *.lock | |
| # Shapefiles |
argparse in
Python 2.7 doc |
Python 3.6 doc
import argparse
if __name__=='__main__':
parser = argparse.ArgumentParser()| url = 'https://www.web.site/downloads/file.zip' | |
| # Method 1: With `requests` module | |
| import requests | |
| response = requests.get(url) | |
| with open('local_file.zip', 'wb') as f: | |
| f.write(response.content) |