py.Str; py.FromCStr/FromCStrAndLen/FromGoString

This commit is contained in:
xushiwei
2024-07-04 18:34:00 +08:00
parent 23da63767c
commit e55e90db1a
11 changed files with 77 additions and 17 deletions

View File

@@ -1,12 +1,12 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/py"
"github.com/goplus/llgo/py/math"
"github.com/goplus/llgo/py/std"
)
func main() {
x := math.Sqrt(py.Float(2))
c.Printf(c.Str("sqrt(2) = %f\n"), x.Float64())
x := math.Sqrt(py.Float(2)) // x = sqrt(2)
std.Print(py.Str("sqrt(2) ="), x) // print("sqrt(2) =", x)
}