The program I was attempting to make was going to be
1.open notepad
2.fill 1 - 2 pages with text
3.save the file (named "1")
4.loop with a different saved name each time (IE named 1, then named 2, then 3, etc etc)

I can open notepad, and loop that, but filling it with strings has me stumped, along with saving it, I would appreciate any help with this.

I'm not sure if its relevant but to open notepad and loop it I used;

import subprocess

notes = subprocess.Popen("notepad")

Recommended Answers

All 4 Replies

Why do you have to use Notepad? Couldn't you just create a text file?

x = 1
while x < 3:
	file_name = "named %s" %x
	out_file = open(file_name, "w")
	out_file.write("Test\n")
	out_file.close()
	x += 1

Umm, I am probably missing something, but whenever I run that in The IDLE, all it does is bring me to the shell and just leaves it blank. Is there something that I'm missing?

You of curse start a new file in the IDLE editor window for the permanent code? Command line is for experiments and testing only. Finally you should run your code directly from command line to test the real behaviour of the program. Also the speed the program runs directly without Idle is faster.

I dont really like idle. Python is a great language but idle is like ?????
pydev or geany will do. try them out.

Also to you Twisted velocity , Try and simplify what you want to do. Always think abut the easiest way in solving a problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.