gethostname expects exactly 0 arguments 1 given
This error occurs when the gethostname() function is called with an argument, but it doesn't expect any arguments.
For example:
import socket
socket.gethostname("localhost")
In this case, the gethostname() function is called with the argument "localhost". However, the function doesn't expect any arguments, hence the error message "expects exactly 0 arguments, 1 given".
To fix this error, simply remove the argument from the gethostname() function call:
import socket
socket.gethostname()
``
原文地址: http://www.cveoy.top/t/topic/cpV0 著作权归作者所有。请勿转载和采集!