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


Groups > comp.lang.python > #8616

Re: text file

Date 2011-07-01 01:49 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: text file
References <15d8f853-7c87-427b-8f21-e8537bde89fa@x12g2000yql.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.531.1309481452.1164.python-list@python.org> (permalink)

Show all headers | View raw


On 01/07/2011 01:19, Siboniso Shangase wrote:
> Hi
> i m very new to python and i need hepl plz!!
>
> 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\ja2.wav Data\ja2.mfc
> Data\ja3.wav Data\ja3.mfc
> Data\ja4.wav Data\ja4.mfc
> .
> .
> .
> .
> Data\ja(n).wav Data\ja(n).mfc
>
> Data\ma1.wav Data\ma1.mfc
> Data\ma2.wav Data\ma2.mfc
> Data\ma3.wav Data\ma3.mfc
> Data\ma4.wav Data\ma4.mfc
> .
> .
> .
> Data\ma(n).wav Data\ma(n).mfc
>
This should give you a start:

path_of_samples_file = "samples.txt"

with open(path_of_samples_file, "w") as samples_file:
     for index in range(1, 101):
         samples_file.write("Data\\ja{0}.wav 
Data\\ja{0}.mfc\n".format(index))

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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