printing - Python: will not read a certain file in a for loop -
I have a directory that contains files and all of them processed except for one, file2.txt Are done the_script.py script.
Freedom I have run a simple line in file2.txt: print line and it worked fine. If the lines were printed then the file is not a problem, it is formatted as other people (automatically, the production of any other script).
here the_script.py :
#! # [...] The rest of the code is not related to the questions for the file name in glob.glob ("outdir / * _mapp"): #im * _mapp extension infilemapp = open ( Filename) With print "start" print infilemapp #test, it is necessary to get all the files in the Outdir / directory, all filenames = (file name simplified ("/", 1) [1]) [: - 5] # / Acorus.txt_mapp - & gt; Acorus.txt IRREVEVANT PARSING LINE infilelpwe = organism + "_ lpwe" # acorus.txt - & gt; IRRELEVANT PARSING LINE for the line in Acileus.txt_lpwe infilemapp: print line print "End" What do I expect, for all files, "start, file name, file content, end" To achieve. I get it in the console:
bash-4.3 $ ./the_script.py get started & lt; Open file 'outdir / file1.txt_mapp', mode 'R' 0x7fb5795ec930 & gt; ['3R', '2F', '0R', '3F', '1R', '4F', '1F'] And Late; Open file 'Outrear / file3 test_map', mode 'R' 0x7fb5795eca50 & gt; ['R', '5 R', '7 R', '4 R', '1 F', '6 R', '2 R', '6 F', '1 R', '4 F' , '7F', '5F' 0F ',' 3R '] End of the End & lt; Open file 'outdir / file2.txt_mapp', mode 'R' & gt; at 0x7fb5795ec930 As you can see, nothing for file2.txt_mapp is printed.
bash-4.3 $ cat outdir / file2.txt_mapp ['5F', '0F', '2F', '6F', '3R', '5R' '6R', '4F', '1R', '4R', '6F'] The file is alphabetical in the middle of all the files for this specific one Why does the script not work? Please if you have any suggestions ...
Comments
Post a Comment