Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'python': 0.08; 'from:addr:python': 0.09; 'subject:file': 0.13; 'wrote:': 0.15; '"w")': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'reply-to:addr:python-list': 0.16; 'header:In-Reply-To:1': 0.22; 'index': 0.25; 'received:84': 0.28; 'to:addr:python-list': 0.34; 'header:User-Agent:1': 0.34; 'reply- to:addr:python.org': 0.35; 'subject:text': 0.35; 'skip:" 10': 0.36; 'skip:o 20': 0.36; 'file': 0.36; 'subject:: ': 0.38; 'should': 0.39; 'data': 0.39; 'to:addr:python.org': 0.39; 'give': 0.60; 'increase': 0.64; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'hepl': 0.84 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqwHAKMYDU5UXebj/2dsb2JhbABSmG2OcXeIesAAhjEElyWLOQ Date: Fri, 01 Jul 2011 01:49:49 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: text file References: <15d8f853-7c87-427b-8f21-e8537bde89fa@x12g2000yql.googlegroups.com> In-Reply-To: <15d8f853-7c87-427b-8f21-e8537bde89fa@x12g2000yql.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1309481452 news.xs4all.nl 21744 [2001:888:2000:d::a6]:33857 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8616 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))