this is my code it prints with lots of space after OS Name: how to strip off the white space? was trying to use split, I guess did not use it in right way
OS Name:Microsoft Windows 7 Professional
See the Microsoft Knowledge Base article 2344941
#!/usr/bin/env python
import sys, re, os
lineContains = re.compile('.*OS Name.*')
lineHas = re.compile('.*OS Version.*')
filename = open("system-info.txt", 'r')
for line in filename:
if lineContains.match(line):
''.join(line.split())
print line
if "Windows 7" in line:
print 'See the Microsoft Knowledge Base article 2344941'
else:
print 'See the Microsoft Knowledge Base article 2550978'
filename.close()