1

I know how to write the input to a text file (Python 2.7.x).

How would you go about having pre-written text and user input on the same line?

See:

f.write("Artist: ", toart + "\n")

The error I get is:

f.write("Artist: ", toart + "\n")
TypeError: function takes exactly 1 argument (2 given)

Any help?

4

2 回答 2

2

更改f.write("Artist: ", toart + "\n")==> f.write("Artist: " + toart + "\n")

于 2013-06-16T15:33:22.877 回答
2

尝试这个 :

f.write("Artist: " + toart + "\n")
#                 ^^^

这样你只得到一个要传递的字符串......

于 2013-06-16T15:33:00.287 回答