Issue With Saving Into A Txt In Python 3.3.2
Solution 1:
Firstly, I'm assuming that the import statement isn't atually out-dented, just like that in the sample.
The error TypeError: Can't convert 'int' object to str implicitly
essentially means that it can't add A to B, or in this case, an integer and a string. We can get round this by making
char1[1]="Strength now " + strh1
into:
char1[1]="Strength now " + str(strh1)
This is just saying 'turn strh1
into a string before you add it. But after this I noticed a new error:
TypeError: 'str' object does not support item assignment
.
This is because, at least in this case, you're treating the string as an array, mixed in with dictionary syntax (By the looks of it). I'm not sure what you're doing with the line
char1[1]="Strength now " + strh1
as it appears to me that you're trying to add an item to a dictionary which is not there, so I can only try to explain what's going wrong.
It's also worth noting that when you take an input as a string, it's not necessary to put it as foo = str(input("Bar: "))
as by default python takes inputs as strings. This means you would get the same result from foo = input("Bars: ")
.
Post a Comment for "Issue With Saving Into A Txt In Python 3.3.2"