This topic comes up on a regular basis so I thought I'd address it.

Often on walks or while walking in the house, puppies will "attack" your pants, ankles and feet. Why do they do this? Because they are puppies and it's fun and you are a moving target :)  It's a very normal thing for a puppy to do.

There are a few ways to deal with this. First and foremost is to not yell at the puppy for doing this as you will only be contributing to an already aroused puppy.
If you are on a walk, stop walking. Don't move forward again until the pup has stopped biting. Make sure you are not creating a tug toy by pulling on the leash when he does. If you can get a couple of steps without biting, praise and reward - don't ignore the pup when he's walking nicely.  Reinforce nice walking a lot by praising and rewarding with yummy treats. 
With pups it's not important that they walk perfectly. They just need to walk without pulling you down the street, or biting your ankles.
You can keep a floppy toy with you in your back pocket to bring out and redirect to that. You can attach 2 leashes - one to the harness or collar, the other one drags. When the pup starts to bite the leash, simply drop it and pick up the other one. He will quickly lose interest when there is no tug game. Repeat, repeat, repeat.

Try to be aware of when the pup is biting. Is it when he is over excited? Tired? When you first get home? If that's the case then plan ahead and don't take the pup for a walk until you've played a bit in the house or backyard and burned off some puppy steam. If he is already over stimulated, then wait until he's settled down before going out to walk.

Make sure when you are getting ready for your walk you aren't getting the pup over aroused by making a big deal about going out by saying " ohhh, do you want to go for a walk??? " in a high, excited voice. That will set him up to be over aroused before you even walk out the door. Just get ready, get the leash and go out - keep it low key.

Do not pop the leash or jerk the leash to get your pup to stop biting. Do not grab his face and get physical. You will teach him to be wary of your hands and not want to be by your side. You will get him even more aroused and not accomplish anything.

Remember that everything outside is new to the pup and it can be very overwhelming. Be patient and don't force the pup to walk if he doesn't want to. If you need to get somewhere quickly, pick him up and walk to where you want to go, then put him down.