Unnecessary Context: I'm playing around with trying to make a discord bot (using discord.py) for me and my friends. Currently I'm trying to implement a shop and currency system, I have everything worked out except for converting the .txt contents to an integer
Question: How do I convert the contents of a text file to an integer? Relevant code below:
r = open("money.txt", "r")
money = r.read
x = money # int of text in file somehow
r.close()
w = open("money.txt", "w")
w.write(x)
w.close()
print(x)
Edit: I apologize, I should've said that I tried to int(money) and it gave an error saying: int() argument must be a string, a bytes-like object or a number, not 'builtin_function_or_method.' I fixed the problem by adding parentheses to the money variable so it was money = r.read()