Hey
I'm new to python, but I have used a fair bit of C and Perl
I found Perls regex's to be very easy to use however I don't find
Pythons regexes as good.
All I am trying to do is detect if there is a number in a string.
I am reading the string from an excel spread sheet using the xlrd
module
then I would like to test if this string has a number in it
ie.
import xlrd
import re
doesHaveNumber = re.compile('[0-9]')
string1 = ABC 11
regularExpressionCheck = doesHaveNumber.search(string1)
This will get the right result but then I would like to use the result
in an IF statement and have not had much luck with it.
if regularExpressionCheck != "None"
print "Something"
the result is that it prints every line from the spreadsheet to output
but I only want the lines from the spreadsheet to output.
Is there a way I can drop the regular expression module and just use
built in string processing?
Why si the output from checks in teh re module either "None" or some
crazy memory address? Couldn't it be just true or false?