On 22/08/2012 07:29, Johann Spies wrote:
#start############################################################ import re exclude = re.compile('vn|vt|^$|^#') fileName = '/tmp/x' theFileOpened = open(fileName,'r') theTextAsList = theFileOpened.readlines()theTextAsListStripped = [] for aLine in theTextAsList: theTextAsListStripped.append(aLine.strip("\n")) theTextAsListNoVn = [x for x in theTextAsListStripped if not re.search(exclude,x)] print theTextAsListNoVn Regards Johann _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Please no, not a regex for something this simple!!! -- Cheers. Mark Lawrence. _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
