Reading a file in Python without an extension -
i want read (basically text file) file without extension in python 2.6. have tried following codes following errors..
for infile in glob.glob(os.path.join(path + "bookmarks",'*')): review_file = open(infile,'r').read() print review_file
-> global name glob not defined
f = open(path, "r") text = f.readlines() print text
-> prints "x00\x00\x00\x00\x00\" etc, , not inside of file.
edit: -> conents of file, directly, want, example if file had "023492034blackriver0brydonmccluskey" in it, (as of now) extract bunch of binary values, whereas want exacy contents. how so?
if want use
glob
module, haveimport
first:import glob infile in glob.glob(os.path.join(path, '*')): review_file = open(infile,'r').read() print review_file
are sure file not contain binary data getting?
Comments
Post a Comment