Why don't either of these implementations actually write to the file?
Code v1:
txtfile = open('C:/Python31/SKUs.txt', 'w')
with txtfile:
num = 817
while num <= 820:
x = "G" + str(num)
print(str(x), end=" ")
num += 1
txtfile.close()
Code v2:
txtfile = open('C:/Python31/SKUs.txt', 'w')
num = 817
while num <= 820:
x = "G" + str(num)
print(str(x), end=" ", file = txtfile)
num += 1
print("test", file = txtfile)
txtfile.close()
Also, I could use some further help.
Here's what I want each page to look like (note the big font size of the SKUs relative to the page size, and the spacing):
-----------------------------
| G817 G818 G819 |
| | <-- page 1
| |
| |
|___________________________|
-----------------------------
| G817 G818 G819 |
| | <-- page 2
| | (and so on, until G10000)
| |
|___________________________|
I don't know how to make the font-size huge, or to achieve this spacing through Python code. Nor do I know how to create page breaks. If someone could help me with this that'd be great!
I'm also interested in knowing how to change fonts, and text colors (although it's not necessary for this project).
Additionally, if anyone knows of a good tutorial on writing to files, that'd be greatly appreciated!