#雙星「**」放在字典的前面可以讓你將字典的內容作為命名引數傳遞給函式。
#字典的鍵是引數的名字,鍵的值作為引數的值傳遞給函式
dictionary =
defsomefunction
(a ,b):
print(a + b)
return
#these do the same thing
#somefunction(a=1, b=2)
somefunction(**dictionary)
numbers = [1,2,3,4,5,6,7,8]
evens = [x for x in numbers if x % 2 == 0]
odds = [y for y in numbers if y not
in evens]
#print(evens)
print(odds)
vist
(city):
print("welcome"+city)
for city in cities:
vist(city)
>>>welcome西安>>>welcome北京
>>>welcome秦皇島
>>>welcome廣元
>>>welcome南京
x = [1,2,3,4]
y = list(map(lambda x:x*x*x, x))
print(y)
>>>[1, 8, 27, 64]
keys = ['w','l','m']
values = [4,10,14]
zipped = zip(keys,values)
print(dict(zipped))
>>>
m , n = zip(*zip(keys,values))
print(m,n)
>>>('w', 'l', 'm') (4, 10, 14)
>>>邏輯回歸其實是一種用來做分類的模型,而不是做回歸。
CSS3 工具推薦(不斷更)
cssmatic是乙個非營利性的 css 工具,目前包含4個很有用的工具,分別是 支援各種顏色和透明度的漸變工具,使用漸變工具,您可以建立漸變平滑的色彩變化效果和微妙的透明膠片 邊框圓角工具可以幫助你方便的實現需要的圓角效果 雜訊紋理可以幫助你創造奇妙的背景圖案,能夠實時預覽結果 盒陰影工具可以控制...
sublime常用技巧(持續更
1 自動縮排 設定 preference key bindings user 編輯設定文件,輸入 應用 選擇需要縮排的 後ctrl q即可 2 設定瀏覽器開啟 快捷鍵 選單欄preferences key bindings user 開啟 default windows sublime keymap...
Python技巧 不斷更新中
1.讀取檔案的內容 filepath 檔案路徑 lambda f f.read f.close file filepath 0 2.將內容寫入到檔案中 lambda f,d f.write d f.close file r d a.txt w 要寫入的資料 3.根據正規表示式過濾資料夾中的檔案 im...