w3scholls截圖 w3scholls練習程式碼 #字典 keys:values, 張佑維 #w3schools原來 字串:字串,改成 整數:字串 a = { #市場價值最大的五家公司 2330: "台積電", 2317: "鴻海", 2454: "聯發科", 2412: "中華電", 6505: "台塑化" } print(a) print(a[6505]) print(a.get(2330))#功能同 a[2330] print(a.keys()) #keys()方法列出key搜尋鍵 print(a.values()) #keys()方法列出values值 b = a.copy() print("列出b " + str(b)) print(b[2317]) print(b.clear()) a.update({2308: "台達電"}) print(a.values()) print("用迴圈列出字典a的所有值") for t in a: print(a[t]) 字典方法Dictionary Methods Python has a set of built-in methods that you can use on dictionaries. Method Description clear() Removes all the elements from the dictionary copy() Returns a copy of the dictionary fromkeys() Returns a dictionary with the specified keys and value get() Returns the value of the specified key items() Returns a list containing a tuple for each key value pair keys() Returns a list containing the dictionary's keys pop() ...
張佑維利用w3school學習HTML,CSS,Borders 德 明 張 佑 維 Html上的物件,稱為元素body, p=paragraph, div=division, iframe框架 教學影片138 用w3schools編輯網頁 使用專業程式碼編輯器IDE整合開發環境 整合開發環境(Integrated Development Environment, IDE)。width霓度,height高度,src=source來源。 JAVA變數 String-字串- text, such as "Hello". String values are surrounded by double quotes int-整數- integers (whole numbers), without decimals, such as 123 or -123 F1oat-浮點數,買數- floating point numbers, with decimals, such as 19.99 or-19. 99 char-宇兀-single characters, such as'a'or'B'. Char values are surrounded by singlequotes$1i>boolean-邏輯stores values with two states: true or false
留言
張貼留言