(import requests)
(setv html (. (requests.get "https://www.baidu.com" "headers = {'User-Agent': 'Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/1.2.9'} ") text))
(repr html)
(.splitlines html)
(setv htmls (.splitlines (. (requests.get "https://www.baidu.com" "headers = {'User-Agent': 'Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/1.2.9'} ") text)))
(import numpy)
(setv testmat (.reshape (numpy.arange 100) 10 10))
(repr testmat)
(repr (. testmat T ))
(repr (* (. testmat T ) testmat))
(import math)
(defn mycos [number] (math.cos (math.degrees (math.atan number))))
(mycos 1121.4)
;loop : for i in
(for [i (range 10)] (print i))
; if
(defn myif [judge] (if ( > judge 0) (return judge)))
(myif 7)
; ifs
(defn myifs [somevar] (cond [(> somevar 0) (return "+")] [(< somevar 0) (return "-")] [True (return "zero")]))
(myifs 0)
(for [i (range -10 10) ] (print (myifs i)))
'''np.arange(100).reshape(10 ,10)'''
(import [numpy :as np])
(setv mat_test ((. (np.arange 100 ) reshape ) 10 10))
(print mat_test)
hylang玩玩
最新推荐文章于 2020-02-05 14:36:19 发布