This works fine but I feel it can be better optimized.
#!/usr/bin/env py
s = "1:5.9,1.5:7,2:10,4:18,8:40"
load_value = raw_input("Enter a load value\n")
li = s.split(',')
driver = None
for index,item in enumerate(li):
if load_value == li[index].split(':')[1]:
driver = li[index].split(':')[0]
print driver
if not driver:
print "Could not find driver value"
Output:
Enter a load value 5.9 1
li[index].split(':')
twice. Call it once, store the result and than use [0] and [1] on it. \$\endgroup\$