learn-python3-thw-code icon indicating copy to clipboard operation
learn-python3-thw-code copied to clipboard

learn-python3-ex15.py

Open divyang805 opened this issue 6 years ago • 0 comments

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

divyang805 avatar Nov 30 '18 05:11 divyang805