Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46948
| Date | 2013-06-04 10:44 -0700 |
|---|---|
| From | Gary Herron <gherron@digipen.edu> |
| Subject | Re: create new python file |
| References | <d1eaf703-d15f-486a-a0f1-a8dea4176d60@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2671.1370368207.3114.python-list@python.org> (permalink) |
On 06/04/2013 09:07 AM, kakararunachalservice@gmail.com wrote:
> Hi,
> Can anyone please tell me how to dynamically create a new python file within a program???
What do you mean by a "python file"? If you mean a text file
containing python code, then create it like any other text file. For
instance:
with open("Hello.py", "w") as f:
print("print('Hello world')\n", file=f)
will create a file containing a simple one-line Python program.
If you meant something else, then please take the time to provide more
detail.
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
create new python file kakararunachalservice@gmail.com - 2013-06-04 09:07 -0700
Re: create new python file Fábio Santos <fabiosantosart@gmail.com> - 2013-06-04 17:18 +0100
Re: create new python file Gary Herron <gherron@digipen.edu> - 2013-06-04 10:44 -0700
Re: create new python file kakararunachalservice@gmail.com - 2013-06-04 11:09 -0700
Re: create new python file rusi <rustompmody@gmail.com> - 2013-06-04 11:21 -0700
Re: create new python file kakararunachalservice@gmail.com - 2013-06-04 11:54 -0700
RE: create new python file Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-06-04 23:00 +0300
Re: create new python file Tobiah <toby@tobiah.org> - 2013-06-04 13:24 -0700
csiph-web