On 15/08/2019 15:10, Stephen P. Molnar wrote: > I need to find a phrase in i text file in order to read a unique text > string into a python3 application. > > I have become stuck and Google has not been of any use.
I'm sorry but there is so much wrong here it is difficult to know where to begin. > #!/usr/bin/env python3 > # -*- coding: utf-8 -*- > # > # Extract.Data.py > > import re You don't need re since you are not using any regular expressions. > name = input("Enter Molecule Name: ") > > name_in = name+'_apo-1acl.dlg' This creates a string called name_in. > re.search("RMSD TABLE",name_in()) And here you search for the string(not regular expression) "RMSD TABLE" in the return value from name_in() But name_in is a string, you cannot call a string. >>> "foo"() Traceback (most recent call last): File "<pyshell#6>", line 1, in <module> "foo"() TypeError: 'str' object is not callable > and here is the portion of the text file (Acetyl_apo-1acl.dlg) > containing the information: > > Number of multi-member conformational clusters found = 4, out of 20 runs. > > RMSD TABLE > __________ And this is the only line containing your string so, even if your code worked, this is the only line you would locate. It doesn't look very useful... > Everything that I have tried returns 'TypeError: 'str' object is not > callable'. See my comments above. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor