Hi Members,
I am having a hard time with python code, making it terse. One liners. I see a lot on stackoverflow using lambda. I am unable to cope up with it.
Would really appreciate any input in this regard.
So here is how I am running the file.
Error:
[print i+" doesn't end with .pdb" for i in file_name if not i.endswith(".pdb")]
^
SyntaxError: invalid syntax
Please advise.
I am having a hard time with python code, making it terse. One liners. I see a lot on stackoverflow using lambda. I am unable to cope up with it.
Would really appreciate any input in this regard.
So here is how I am running the file.
python read_pdb_file.py 1iw6.pdb 1m0l.pdb
Code:
def checkExtension2(*file_name): # trying to shrink the code.. [print i+" doesn't end with .pdb" for i in file_name if not i.endswith(".pdb")] def checkExtension(*file_name): # this runs fine for i in file_name: if not i.endswith(".pdb"): print i+" doesn't end with .pdb" sys.exit(1) if __name__=="__main__": checkExtension2(sys.argv[1],sys.argv[2])
[print i+" doesn't end with .pdb" for i in file_name if not i.endswith(".pdb")]
^
SyntaxError: invalid syntax
Please advise.
Comment