Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8618

Re: text file

From John Gordon <gordon@panix.com>
Newsgroups comp.lang.python
Subject Re: text file
Date 2011-07-01 02:34 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <iujbmu$sv2$2@reader1.panix.com> (permalink)
References <15d8f853-7c87-427b-8f21-e8537bde89fa@x12g2000yql.googlegroups.com>

Show all headers | View raw


In <15d8f853-7c87-427b-8f21-e8537bde89fa@x12g2000yql.googlegroups.com> Siboniso Shangase <sms.shangase@gmail.com> writes:

> i want to type this data in a text file it the same the diffrence is
> the number that only increase and i canot write this up myself since
> it up to 5000 samples

> Data\ja1.wav Data\ja1.mfc
> .
> .
> Data\ja(n).wav Data\ja(n).mfc

> Data\ma1.wav Data\ma1.mfc
> .
> Data\ma(n).wav Data\ma(n).mfc

This is a simple python program to do what you want:

  samples = 5000
  for i in range(1, samples):
    print "Data\\ja%d.wav Data\\ja%d.mfc" % (i, i)
  for i in range(1, samples):
    print "Data\\ma%d.wav Data\\ma%d.mfc" % (i, i)

Replace the number 5000 with however many repetitions you want.  (The
loop will stop at one less than the number, so if you want 5000 exactly,
use 5001.)

Then run the program like this from your command line:

  python samples.py > textfile

And it will save the output in "textfile".

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

text file Siboniso Shangase <sms.shangase@gmail.com> - 2011-06-30 17:19 -0700
  Re: text file MRAB <python@mrabarnett.plus.com> - 2011-07-01 01:49 +0100
  Re: text file John Gordon <gordon@panix.com> - 2011-07-01 02:34 +0000

csiph-web