Replace only if the keyword is the first word in every line

How do I replace only if the keyword is at the begining of a line?
Code:
--
a = �This is a print statement�
print a
--
What if I want to replace print by #print only in the second line i.e only if the line starts with that keyword.
Please help me out. I'm new to SED.

-----Post Update-----

I need a SED command. Please help. I couldn't find about it anywhere and had to start a new thread.

echo "print a" | sed 's/^print/#&/'

For some reason the above code does not seem to work.

This is my code:

<--START

a = "This is a print statement
print a
b = "This contains print statement"
print b

END-->

DESIRED:
<--START

a = "This is a print statement
#print a
b = "This contains print statement"
#print b

END-->

Line 4 of the code (print b) should also be commented i.e tabs and space before the first word should be taken care of.

I'm trying to use:
sed 's/[^][pP][rR][iI][nN][tT]/#print/'
sed 's/^[pP][rR][iI][nN][tT]/#print/'
But nothing happens. No part of the code is commented.

If I use:
sed 's/[pP][rR][iI][nN][tT]/#print/'
The first occurence is commented correctly but I want it to be commented only if the line starts with the keyword.

:confused::confused:

> cat a.txt
a = "This is a print statement
print a
b = "This contains print statement"
print b
>
>
>
> sed 's/^[pP][rR][iI][nN][tT]/#print/' a.txt
a = "This is a print statement
#print a
b = "This contains print statement"
#print b

Same problem.
For some reason,

sed 's/^[pP][rR][iI][nN][tT]/#print/' <filename>

is not commenting when the �print' statement starts with a tab/space (See the second encircled code.)

Can someone please give some pointers.
Check the attached screen shot.

sed 's/^\s*[pP][rR][iI][nN][tT]/#print/' a.txt

here '\s' represents any blank space, tab.