Mega Code Archive

 
Categories / Python Tutorial / Regular Expressions
 

Use re package with text file

import re f = open('whodata.txt', 'r') for eachLine in f.readlines():          print re.split('\s\s+', eachLine) f.close()