python - Importing a text file in Python2.7 -
this question has answer here:
- how read file line-by-line list? 30 answers
i want import external files in python. how can it?
will work import module or there other way it?
e.g file name hex.txt.
you can grab file , loop lines stuff this:
filehandle = open("hex.txt", "r") line in filehandle: print (line)
or grab whole file string:
with open("hex.txt", "r") myfile: data=myfile.read()
there several different ways depending on planning on doing data. search around on stackoverflow should started.
Comments
Post a Comment