import re

regex = r"[^\W_\d](?=\S(?!\S))"
s = ("I Like Studying Python Programming\n\n"
	"a) This is a test with 3d\n")

output = re.sub(regex, lambda m: m.group(0).upper(), s)
print(output)