Go中的Print和Printf有何区别?

I am new to Go and understanding simple syntax and functions. Here I am confused between Print and Printf function. The output of those function is similar, so what is the difference between these two functions?

package main
import (
    "fmt"
    "bufio"
    "os"
)
func main(){
    reader := bufio.NewReader(os.Stdin)
    fmt.Print("Enter Text: ")
    str, _ := reader.ReadString('
')
    fmt.Printf(str)
    fmt.Print(str)
}

I read https://golang.org/pkg/fmt/#Print to understand, but I did not understand it.

As per docs

Print: will print number variables, and will not include a line break at the end.

Printf: will not print number variables, and will not include a line break at the end.

Printf is for printing formatted strings. And it can lead to more readable printing.

For more detail visit this tutorial.

From the docs about Printing:

For each Printf-like function, there is also a Print function that takes no format and is equivalent to saying %v for every operand. Another variant Println inserts blanks between operands and appends a newline.

So Printf takes a format string, letting you tell the compiler what format to output your variables with and put them into a string with other information, whereas Print just outputs the variables as they are. Generally you'd prefer to use fmt.Printf, unless you're just debugging and want a quick output of some variables.

In your example you're sending the string you want to print as the format string by mistake, which will work, but is not the intended use. If you just want to print one variable in its default format it's fine to use Print.

Printf method accepts a formatted string for that the codes like "%s" and "%d" in this string to indicate insertion points for values. Those values are then passed as arguments.

Example:

package main

import (
"fmt"      
)

var(
a = 654
b = false
c   = 2.651
d  = 4 + 1i
e   = "Australia"
f = 15.2 * 4525.321
)

func main(){    
fmt.Printf("d for Integer: %d
", a)
fmt.Printf("6d for Integer: %6d
", a)

fmt.Printf("t for Boolean: %t
", b)
fmt.Printf("g for Float: %g
", c)
fmt.Printf("e for Scientific Notation: %e
", d)
fmt.Printf("E for Scientific Notation: %E
", d)
fmt.Printf("s for String: %s
", e)
fmt.Printf("G for Complex: %G
", f)

fmt.Printf("15s String: %15s
", e)
fmt.Printf("-10s String: %-10s
",e)

t:= fmt.Sprintf("Print from right: %[3]d %[2]d %[1]d
", 11, 22, 33)
fmt.Println(t)  
}