text file

Josh Benner sjbenner at gmail.com
Thu Jun 30 20:48:16 EDT 2011


import os

lst = []
for x in xrange(1, 5001):
    lst.append(r"Data\ma{0}.wav Data\ma{0}.mfc".format(x))
    lst.insert(x-1, r"Data\ja{0}.wav Data\ja{0}.mfc".format(x))

with open("filename.txt", "w") as fd:
    sep = os.linesep
    fd.write(sep.join(lst))


On Thu, Jun 30, 2011 at 5:19 PM, Siboniso Shangase
<sms.shangase at gmail.com>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
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110630/6e38cdc8/attachment-0001.html>


More information about the Python-list mailing list