亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Go 中是否有 Python 的 `dir()` 和 `help()` 之類的實用程序?

Go 中是否有 Python 的 `dir()` 和 `help()` 之類的實用程序?

Go
一只甜甜圈 2022-07-18 16:19:48
使用 Python,我們可以像這樣使用dir()和help():>>> import random>>> dir(random)['BPF', 'LOG4', 'NV_MAGICCONST', 'RECIP_BPF', 'Random', 'SG_MAGICCONST', 'SystemRandom', 'TWOPI', '_BuiltinMethodType', '_MethodType', '_Sequence', '_Set', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_acos', '_bisect', '_ceil', '_cos', '_e', '_exp', '_inst', '_itertools', '_log', '_os', '_pi', '_random', '_sha512', '_sin', '_sqrt', '_test', '_test_generator', '_urandom', '_warn', 'betavariate', 'choice', 'choices', 'expovariate', 'gammavariate', 'gauss', 'getrandbits', 'getstate', 'lognormvariate', 'normalvariate', 'paretovariate', 'randint', 'random', 'randrange', 'sample', 'seed', 'setstate', 'shuffle', 'triangular', 'uniform', 'vonmisesvariate', 'weibullvariate']>>> help(random.randint)Help on method randint in module random:randint(a, b) method of random.Random instance    Return random integer in range [a, b], including both end points.是否有 Pythondir()和help()Go 之類的實用程序?
查看完整描述

1 回答

?
慕雪6442864

TA貢獻1812條經驗 獲得超5個贊

你尋求的是go doc。


go doc fmt.Printf

當前產生輸出:


package fmt // import "fmt"


func Printf(format string, a ...interface{}) (n int, err error)

    Printf formats according to a format specifier and writes to standard

    output. It returns the number of bytes written and any write error

    encountered.

您可能還對godoc感興趣,它將為您的 GOPATH 中的任何內容生成文檔,甚至可以運行 http 服務器在本地瀏覽它。


查看完整回答
反對 回復 2022-07-18
  • 1 回答
  • 0 關注
  • 259 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號