我在终端中运行 python 脚本(file.py),它不打印函数的结果。您可以在下面找到我的终端打印,谢谢。
stest@debian:~/Documents/python$ ls -l | grep tic_tac.py
-rwxr-xr-x 1 stest stest 270 Oct 14 15:58 tic_tac.py
stest@debian:~/Documents/python$ cat tic_tac.py
#!/usr/bin/env python
d_b = [" " for i in range(9)]
print (d_b)
def b():
r_1 = "|{}|{}|{}|".format(d_b[0],d_b[1],d_b[2])
r_2 = "|{}|{}|{}|".format(d_b[3],d_b[4],d_b[5])
r_3 = "|{}|{}|{}|".format(d_b[6],d_b[7],d_b[8])
print (r_1)
print (r_2)
print (r_3)
print (b)
stest@debian:~/Documents/python$ ./tic_tac.py
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
<function b at 0x7f6bd9f28668>
stest@debian:~/Documents/python$ python3 tic_tac.py
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
<function b at 0x7f63232c01e0>
stest@debian:~/Documents/python$