如果我今晚很愚蠢,我不会这样做,但由于某种原因,这在 Python 中不起作用。我正在尝试在python中的函数中设置变量,每当我打印它们时,我都会得到一个“函数+函数名称+十六进制值而不是字符串”,任何人都可以给我一些建议吗?
import sys
def serverAdd():
global serverAdd
if len(sys.argv) <2:
serverAdd = input('Please enter server address:')
else:
serverAdd = sys.argv[1]
def serverPort():
global portNumber
if len(sys.argv) <3:
portNumber = input('Please enter port number for server:')
else:
portNumber = sys.argv[2]
def serverPassword():
global serverPassword
if len(sys.argv)< 4:
password = input('Please enter server password:')
else:
password = sys.argv[3]
serverAdd()
print(serverAdd)
serverPort()
print(serverPort)
serverPassword()
print(serverPassword)``
谢谢