Write a Python code snippet to convert a string to a dictionary.
'student=John&grade=A'
my_dict = dict(item.split("=") for item in s.split("&"))

print(my_dict) # prints {'student': 'John', 'grade': 'A'}