0

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")

Edited by TwistedVelocity: n/a

4
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by richieking
1

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
0

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?

0

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.

Edited by pyTony: n/a

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.