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?

  1. if want use glob module, have import first:

    import glob infile in glob.glob(os.path.join(path, '*')):     review_file = open(infile,'r').read()     print review_file 
  2. are sure file not contain binary data getting?


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -