Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83502
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ganesh1pal@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; '(b)': 0.07; 'column': 0.07; 'subject:file': 0.07; 'string': 0.09; 'f.close()': 0.09; 'repeated': 0.09; '.txt': 0.16; 'columns': 0.16; 'expecting': 0.16; 'i.e': 0.16; 'subject:writing': 0.16; 'trying': 0.19; 'written': 0.21; 'input': 0.22; 'example': 0.22; 'import': 0.22; 'to:name:python-list@python.org': 0.22; '(a)': 0.24; 'questions:': 0.24; 'file.': 0.24; 'subject: : ': 0.26; '(c)': 0.29; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'file': 0.32; 'open': 0.33; 'skip:# 10': 0.33; 'received:google.com': 0.35; 'add': 0.35; 'easiest': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'provide': 0.64; 'saturday': 0.68; '\xc2\xa0\xc2\xa0': 0.74; 'day': 0.76 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=AnFMIaOhsZLAVtHdE04cAluFEYTKFoBeBbRugqZ0gfY=; b=xAMjT1LQUDH3N2DSAXFIKMfgDG8H1wRLiW51XSdBOK5mfRSeXakSTpGvbSHCQTeki4 4ImNQvyup+OgYnAx4A09gnQztLb3Mn2PLVrgf2Zksuci/lLz6IutHSEcH5A98zdF+O3x gqFLzCapM22M4lkpRKTlpFTMKmNt/9TQLjJ5HYBH5NvmE1Kmdp+PSq45Iig1Ij1MRiS/ hAzqZjvfYFcM+uAjbPlINr4GCQscNOoL7lOPUahZKgNdwQ13UzENSDXcwOVefkOwpN5/ VJKgoTehTNw9IsA2Zpu+kheMU3BWcX6KD7svbZAYWgKeMQ/rAoaOx7dHQGZc3l0hPKvh VHjg== |
| MIME-Version | 1.0 |
| X-Received | by 10.112.73.66 with SMTP id j2mr27528258lbv.44.1420902849632; Sat, 10 Jan 2015 07:14:09 -0800 (PST) |
| Date | Sat, 10 Jan 2015 20:44:09 +0530 |
| Subject | Python : writing to a file |
| From | Ganesh Pal <ganesh1pal@gmail.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=001a11c344b49cdec6050c4db9cc |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17565.1420902853.18130.python-list@python.org> (permalink) |
| Lines | 72 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1420902853 news.xs4all.nl 2899 [2001:888:2000:d::a6]:60211 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:83502 |
Show key headers only | View raw
[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