Python Error Typeerror: Function Takes Exactly 1 Argument (5 Given)
Traceback (most recent call last): File 'wdd.py', line 164, in file.write('temperature is ', temperature, 'wet is ', humidity, '%\n') TypeError: function takes
Solution 1:
file.write()
only takes one argument, a string. You've given it five instead:
file.write("temperature is ", temperature, " wet is ", humidity, "%\n")
Make that one string:
file.write("temperature is " + str(temperature) + " wet is " + str(humidity) + "%\n")
or use string formatting:
file.write("temperature is {} wet is {}%\n".format(temperature, humidity))
file.write()
does not act like a print
statement.
Post a Comment for "Python Error Typeerror: Function Takes Exactly 1 Argument (5 Given)"