py/README

This commit is contained in:
xushiwei
2024-05-11 05:18:17 +08:00
parent 31d91f5e87
commit 67896c63a7
5 changed files with 55 additions and 12 deletions

View File

@@ -1,16 +0,0 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/py"
)
func main() {
py.Initialize()
py.SetProgramName(*c.Argv)
math := py.ImportModule(c.Str("math"))
sqrt := math.GetAttrString(c.Str("sqrt"))
sqrt2 := sqrt.CallOneArg(py.Float(2)).FloatAsDouble()
c.Printf(c.Str("sqrt(2) = %f\n"), sqrt2)
py.Finalize()
}