資料來源:http://disp.cc/b/11.cj-2q1S
當要抓取一段不固定的字串,例如 <b> 與 </b> 中間的字。
最常看到的方法就是使用正規表示式 regular expression (以下簡稱 regex):
| #!/usr/bin/python | |
| import os, zipfile | |
| for filename in os.listdir("."): | |
| if filename.endswith(".zip"): | |
| print filename | |
| name = os.path.splitext(os.path.basename(filename))[0] | |
| if not os.path.isdir(name): | |
| try: | |
| zip = zipfile.ZipFile(filename) |
| #Installing VirtualBox | |
| echo "Installing VirtualBox........................" | |
| sudo apt-get install virtualbox | |
| #Installing kubectl https://kubernetes.io/docs/getting-started-guides/kubectl/ | |
| echo "Installing kubectl..........................." | |
| wget https://storage.googleapis.com/kubernetes-release/release/v1.4.4/bin/linux/amd64/kubectl | |
| chmod +x kubectl | |
| sudo mv kubectl /usr/local/bin/kubectl |
資料來源:http://disp.cc/b/11.cj-2q1S
當要抓取一段不固定的字串,例如 <b> 與 </b> 中間的字。
最常看到的方法就是使用正規表示式 regular expression (以下簡稱 regex):