learn-python3-thw-code
learn-python3-thw-code copied to clipboard
learn-python3-ex15.py
hello sir i'm at ex15 of learn python 3 the hard way and want to convert content of file into integer but got no way to do that.
i tried converting variable to integer which is holding a file
int_txt = int(txt)
but it gives an error like typeerror
TypeError: int() argument must be a string, a bytes-like object or a number, not '_io.TextIOWrapper'
my whole code is like
`from sys import argv
script, filename = argv
txt = open(filename , encoding = "utf-8")
print(f"Here's your file {filename}:") print(txt.read()) print(type(filename))`
i tried checking that the content of file is in string or what so i got it's in string
so need help @zedshaw