<p>I want to write a program that would print every combination of a set of variables to a text file, creating a word list. Each answer should be written on a separate line and write all of the results for 1 digit, 2 digits, and 3 digits to a single text file.</p>

<p>Is there a simple way I can write a python program that can accomplish this? Here is an example of the output I am expecting when printing all the binary number combinations possible for 1, 2, and 3 digits:</p>

<pre><code>Output:
0  
1

00  
01  
10  
11

000  
001  
010  
011  
100  
101  
110  
111
</code></pre>

It shouldn't be too hard in most languages.  Does the following pseudo-code help?
```
```
for(int i=0; i < 2^digits; i++)
{
     WriteLine(ToBinaryString(i));
}
```
```