How do I do a case insensitive string comparison in Python?

What's the best way to do case insensitive string comparison in Python?

I would like to encapsulate comparison of a regular strings to a repository string using in a very simple and pythonic way. I also would like to have ability to look up values in a dict hashed by strings using regular python strings. Much obliged for advice.


Assuming ASCII strings:

string1 = 'Hello'
string2 = 'hello'

if string1.lower() == string2.lower():
    print "The strings are the same (case insensitive)"
    print "The strings are not the same (case insensitive)"

Need Your Help

How to insert/update an item in a specific column of a dynamic table?

javascript jquery append html-table

I have a dynamic table as of here As you can see, I have a column for "Status" which i hope to get status reply through this done(function()). This is what i've tried

Dump protocol-buffers data/response

c# protocol-buffers protobuf-net fiddler

Is it possible to dump(view) data written in PB format without any knowledge about types used to write that data?

Simple Bash - for f in *

file bash loops for-loop

Consider this simple loop:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.