Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83502
| Date | 2015-01-10 20:44 +0530 |
|---|---|
| Subject | Python : writing to a file |
| From | Ganesh Pal <ganesh1pal@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17565.1420902853.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
Please provide you input on the below questions:
(a) I was expecting the string i.e day of week , example Saturday to be
written in the file. what Iam I missing in the below program ?
Program:
#!/usr/bin/python
import time
f = open ('test_2.txt','w+b')
DAY = time.strftime("%A")
f.write(DAY)
f.close()
Throttling-1# cat test_2.txt
(b) Iam trying to generate a file in the below format ,
cluster1# cat test_2.txt
Saturday 0:05 0:10
Saturday 0:10 0:20
Saturday 0:20 0:30
Saturday 0:40 0:50
Saturday 0:60 0:70
(a) what is the easiest way to generate the above file fprmat ?
(b) how will I take care that the below format is repeated in the .txt file
( i.e column and row spacing)
DAY OF THE WEEK [SPACE] START TIME [ SPACE] ENDTIME{SPACE]
(c) how do I add START TIME [ SPACE] ENDTIME{SPACE] columns
Regards,
Ganesh
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Python : writing to a file Ganesh Pal <ganesh1pal@gmail.com> - 2015-01-10 20:44 +0530 Re: Python : writing to a file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-11 04:06 +1100
csiph-web