I'm afraid you've miscounted. In this case, it would be better to count indirectly, by finding the numbers that don't have the digit $2$ in them, then subtracting these from the total.
First, let's count the number of $6$-digit numbers without a $2$ in them. There are $8$ choices for the leading digit of such a number, and for each of the other $5$ digits, there are $9$ choices. Thus, there are $8\cdot 9^5$ such numbers. Similarly, we can find that $8\cdot 9^4$ $5$-digit numbers without a $2$ in them, and so on, down to the $2$-digit numbers. Depending on whether $0$ is considered a $1$-digit number, there are either $8$ or $9$ numbers with one digit and no $2$'s. It turns out that the answer is not affected, either way, as I will discuss below.
Note Depending on whether you are taking $0$ to be a number, the number in the $1$-digit case will differ (though the answer, itself, will not). In fact, if you are taking $0$ to be a number, then the answer is greatly simplified, as you need only choose one of the $9$ available digits for each of the $6$ decimal places. This yields $9^6$ numbers less than $1000000$ without $2$ as a digit, out of a total of $1000000=10^6$ numbers less than $1000000.$ This also suggests an alternate approach in the case that $0$ is not a number being considered. Proceed as before, but discard zero as an option, so there are $9^6-1$ numbers less than $1000000$ without $2$ as a digit, out of a total of $999999=10^6-1$ numbers less than $1000000.$ In either case, there are $10^6-9^6$ numbers less than $1000000$ with $2$ as a digit.
This even agrees with the (more intuitive but less efficient) method outlined above. In general, we can find the sum using the formula for sums of geometric progressions. Alternately, here's a neat trick we can use.
Now, assume that $0$ is not among the numbers under consideration. (As we saw above, this won't make a difference.) In that case, there are $8=8\cdot 9^0$ single-digit numbers not equal to $2$. Hence, there are $$8\cdot9^5+8\cdot9^4+8\cdot9^3+8\cdot9^2+8\cdot9^1+8\cdot9^0$$ numbers less than $1000000$ that do not have $2$ as a digit. Let's call this sum $S$. Now, $$\begin{align}9S &= 9\left(8\cdot9^5+8\cdot9^4+ 8\cdot9^3+8\cdot9^2+8\cdot9^1+8\cdot9^0\right)\\ &= 8\cdot9^6+8\cdot9^5+8\cdot9^4+8\cdot9^3+8\cdot9^2+8\cdot9^1\\ &= 8\cdot9^6+S-8\cdot9^0\\ &= S+8\cdot\left(9^6-9^0\right)\end{align}$$ so $$8S=8\cdot\left(9^6-9^0\right),$$ and so $$S=9^6-9^0=9^6-1.$$ Since there are $10^6-1$ numbers less than $1000000,$ then as above, there are $$10^6-9^6=468559$$ numbers less than $1000000$ with $2$ as a digit.
reduce(lambda x,y:x+y, [1 for x in xrange(1000000) if '2' in str(x)])
$\endgroup$