python - An integer is required? open() -


I have a very simple dragon script, which should scan a text file, in which The form of lines is formatted as id = ' value ' and put them in a word Python module is called chval.py and the input file is in.txt. This code is:

os, sys import * vals = {} f = open (sys.argv [1], 'r') from the OS import to the line in sys: val_f : T = line.split ('=') T [1]. Strip ('' '') vals.append (t [0], t [1]) print vals f.close ()

When I try to run it I get:

traceback (most recent call final):
File "chval.py", line 9 , In? F = Open (sys.argv [1], 'r') TypeError: An integer is required

I am using Python 2.4 ... because I do not use Has challenged anything new, what about open () is something I do not know? Why does it want an integer?

After that line, nothing is unheard of. In short: Why is this giving me the error and how do I fix it?

Because you have been using osopen from os import * by , Which in fact requires an integer flag instead of "R" or "WA" of any lesson. Exit that line and you will get that error.


Comments

Popular posts from this blog

delphi - Mouseover hint for TChart series value -

c++ - Linux and clipboard -

How to Create Master-Details view using Asp.Net MVC framework -