Tuesday, 10 September 2013

Regex list files, when windows cannot create that file that already exists

Regex list files, when windows cannot create that file that already exists

Basically, I want to list only those files that windows will not create.
How do I list 4.txt and 4a.txt instead ... s == s being true?
myList = '''
4.txt
4a.txt
spam
'''
myregex = 'a'
s = re.sub(myregex,'',myList)
if s == s:
print "got it!" # prints 'got it'
print s == s # prints 'true'

No comments:

Post a Comment