To address your newest constraint about blank lines, I would try something like:
myprops = {}
with open('filename.properties', 'r') as f:
for line in f:
line = line.rstrip() #removes trailing whitespace and '\n' chars
if "=" not in line: continue #skips blanks and comments w/o =
if line.startswith("#"): continue #skips comments which contain =
k, v = line.split("=", 1)
myprops[k] = v
It's very clear and it's easy to add on extra constraints, whereas using a dict comprehension will get quite bloated. However, you could always format it nicely
myprops = dict(line.strip().split('=')
for line in open('/Path/filename.properties'))
if ("=" in line and
not line.startswith("#") and
<extra constraint> and
<another extra constraint>))