原创 const修飾變量時可能發生的錯誤

C++ const 允許指定一個語義約束,編譯器會強制實施這個約束,允許程序員告訴編譯器某值是保持不變的。如果在編程中確實有某個值保持不變,就應該明確使用const,這樣可以獲得編譯器的幫助。 const int a = 10; a =

原创 requests-BeautifulSoup爬取美女貼吧圖片

xx纔是第一生產力 爬取頁面http://tieba.baidu.com/p/2166231880 1.getHtml(url)根據頁面鏈接獲取頁面內容,值得值得注意的是這裏使用了see_lz=1的參數獲得只看樓主的頁面,防止其他圖片的干

原创 shell數學運算案例

來源:https://coding.m.imooc.com/classindex.html?cid=314 案例1 :利用bc 命令進行浮點數運算 #!/bin/bash #輸入兩個數計算兩個數的商 read -p "num1: "

原创 shell腳本變量替換

 來源:https://coding.m.imooc.com/classindex.html?cid=314 #!/bin/bash variable_1="me:i love you, do you love me , girl:i

原创 shell命令替換

來源:https://coding.m.imooc.com/classindex.html?cid=314 語法:    語法格式 方法一 ·command· 方法二 $(conmand)         作用: 將一個命令的結果作爲另一

原创 shell字符串處理腳本

來源:https://coding.m.imooc.com/classindex.html?cid=314 下面的腳本對string進行簡單的處理 1.統計string長度 2.刪除string所有的Hadoop 3.替換第一個Hadoo

原创 shell函數案例

來源:https://coding.m.imooc.com/classindex.html?cid=314 1.函數返回值 shell函數返回值分爲兩種 return: return 只能返回0~255整數,0表示函數運行成功,非0表示函

原创 冒泡排序

data = [4,3,7,2,10,23,11,24,13,2,1] n = len(data) #冒泡排序 def paoSort(): for i in range(n-1): for j in ra

原创 jni訪問數組

   

原创 matplotlib折線圖

import matplotlib.pyplot as plt from pylab import mpl #折線圖 def ployLine(): #繪製折線點 #產生x,y列表,由於折線圖的的性質x,y必須一一對應

原创 tar命令

原创 python當前路徑

 test.py import os print(__file__) print(os.path.dirname(__file__)) print(os.path.abspath(__file__)) print(os.path.abs

原创 optparse示例

from optparse import OptionParser parser = OptionParser() parser.add_option("-n", "--n", dest="name", help="what's yo

原创 python 迭代器

"""手寫一個迭代器 顯示python 中迭代器的原理""" import time class Girls(object): def __init__(self): self.names = ["lena"

原创 linux相關命令(極客時間筆記)

用戶相關 passwd 修改命令 useradd 添加用戶 文件相關 cat 查看文件 ls -l 以列表的形式查看當前目錄下的文件列表 chmod 修改文件權限 chown 修改文件用戶 chgru 修改文件所屬組 軟件相關(無軟件管家