Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

learn-python3-ex15.py #11

Open
divyang805 opened this issue Nov 30, 2018 · 0 comments
Open

learn-python3-ex15.py #11

divyang805 opened this issue Nov 30, 2018 · 0 comments

Comments

@divyang805
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant