case-sensitive

Any difference between str.capitalize() and str.title()?

Any difference between str.capitalize() and str.title()? Question: Is there any difference in str.title() vs str.capitalize()? My understanding from the docs is that both methods capitalize the first letter of a word and make the rest of the letters lowercase. Did anyone run into a situation where they cannot be used interchangeably? Asked By: mysl || …

Total answers: 3

How to read case-insensitive string of column name pandas

How to read case-insensitive string of column name pandas Question: How can I read Excel documents which have the same number of columns and it should have same names of columns, but in some columns could be uppercase "d" and in others lowercase "d"? I am appending data frames which I have to read first, …

Total answers: 1

python pandas: case insensitive drop column

python pandas: case insensitive drop column Question: I have a df and I want to drop a column by label but in a case insensitive way. Note: I don’t want to change anything in my df so I’d like to avoid ‘str.lower’. heres my df: print df Name UnweightedBase Base q6a1 q6a2 q6a3 q6a4 q6a5 …

Total answers: 2

Case insensitive matching python

Case insensitive matching python Question: I want to match items from one list in another without worrying about case sensitivity. mylist1 = [‘fbH_q1ba8’, ‘fHh_Q1ba9’, ‘fbh_q1bA10′,’hoot’] mylist2 = [‘FBH_q1ba8’, ‘trick’,’FBH_q1ba9′, ‘FBH_q1ba10′,’maj’,’joe’,’civic’] I was doing this before: for item in mylist2: if item in mylist1: print “true” else: print “false” But this fails because it is not …

Total answers: 3

How can I convert Unicode to uppercase to print it?

How can I convert Unicode to uppercase to print it? Question: I have this: >>> print ‘example’ example >>> print ‘exámple’ exámple >>> print ‘exámple’.upper() EXáMPLE What I need to do to print: EXÁMPLE (Where the ‘a’ gets its accute accent, but in uppercase.) I’m using Python 2.6. Asked By: Alex. S. || Source Answers: …

Total answers: 5

Case insensitive regular expression without re.compile?

Case insensitive regular expression without re.compile? Question: In Python, I can compile a regular expression to be case-insensitive using re.compile: >>> s = ‘TeSt’ >>> casesensitive = re.compile(‘test’) >>> ignorecase = re.compile(‘test’, re.IGNORECASE) >>> >>> print casesensitive.match(s) None >>> print ignorecase.match(s) <_sre.SRE_Match object at 0x02F0B608> Is there a way to do the same, but without …

Total answers: 11