Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46950
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-06-04 11:09 -0700 |
| References | <d1eaf703-d15f-486a-a0f1-a8dea4176d60@googlegroups.com> <mailman.2671.1370368207.3114.python-list@python.org> |
| Message-ID | <6dbe9ca4-389a-4bb6-b4bc-5efbaa780716@googlegroups.com> (permalink) |
| Subject | Re: create new python file |
| From | kakararunachalservice@gmail.com |
On Tuesday, June 4, 2013 11:14:32 PM UTC+5:30, Gary Herron wrote:
> 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
Thank you so much! Why didn't i thought about that. So, can i program within just by the print statement? Or do i have to do something else. I'm sorry, i just learning python. Thanks again!
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