Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Joel Goldstick Newsgroups: comp.lang.python Subject: Re: Appending an asterisk to the end of each line Date: Tue, 5 Jul 2016 18:40:51 -0400 Lines: 46 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de KSJcyLHvdURoDuZ1iXDfpQueG5t2+o2qob2eRsdd3zqQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'cc:addr :python-list': 0.09; "'w')": 0.09; 'url:blog': 0.10; 'python': 0.10; 'python.': 0.11; "'r')": 0.16; '2016': 0.16; '>>on': 0.16; 'empty.': 0.16; 'file?': 0.16; 'received:io': 0.16; 'received :mail-oi0-x22a.google.com': 0.16; 'received:psf.io': 0.16; 'reinstalled': 0.16; 'wrote:': 0.16; 'creates': 0.18; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'posted': 0.21; 'tried': 0.24; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'installed': 0.26; 'message-id:@mail.gmail.com': 0.27; "skip:' 10": 0.28; 'subject:end': 0.29; 'url:mailman': 0.30; 'folder': 0.30; 'run': 0.33; 'url:python': 0.33; 'url:listinfo': 0.34; 'tue,': 0.34; 'file': 0.34; 'running': 0.34; 'received:google.com': 0.35; 'so,': 0.35; 'text': 0.35; 'path': 0.35; 'but': 0.36; 'url:org': 0.36; 'lines': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'several': 0.38; 'skip:o 20': 0.38; 'subject:the': 0.39; 'url:mail': 0.40; 'ago.': 0.61; 'reuse': 0.66; 'url:info': 0.71; 'jul': 0.72; 'seymore4head': 0.84; 'subject:Appending': 0.84; 'to:none': 0.91; 'joel': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=3SojnexhmP88Z23v+9DEKxrOUdTmFMNOMqRNh+Ke9hw=; b=iSs8DsIHJvUfba8alp78SVD8Bp7oZS2uw7DVBm7BlFgs4+cH7VJ5btnvj437Q+fga+ inVnBKLH1YF/+bRq43xldtEfNoX8iExtscewyOHuIqUDseAN7Zy+byA3EvnFzXlvfxlK rUFpXKBWqckT/N06CKKx3NyY2zadAc2gyIUzUCfAbrjICEuw8uH9fNhYk8rayI4tXAh9 4n5tdIkoX3+QX+xNJZWESbPQu7URYWbpVEnGjqW0b7sETBe+vaxOsPAAgjc4G1rRiG1h GocaFiJiDG85gnRPSNgX9H9vwMocGL5pK2MElRQlYsX1QGJO0EPDc4WU4KzEXdOLpKlK Z9Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=3SojnexhmP88Z23v+9DEKxrOUdTmFMNOMqRNh+Ke9hw=; b=iZCx0gjavOmB/Hk88M08HKG6nJGOIuAkf3klKZNp+gYdqIZhOycilcZKspnzZjyOOg afjVjx0/sZEGJgdoyU0hu36xXRkJJh/uVkT99Td3cqTvhdw/BMv2/PflgyPLuZYs+L/k 81phWFSJ7vJ/ufY3lTDVklZ+Pk/leHBasM3kd63zR4kgKNfWmhCoyywElqPMKPI7igHU 8B4QyJyL8rGt7JYmL5GL6FjbUeaJoIJChnuoK5vE9gQccYhyyQZUuzGKisOuMlqFnAD7 +yfXdkjdAJ7WdnmINdF7LlxwaeIeFJmDrUGGOnTWZ/sshC+CU3yeCnxToBYpwCFksE62 Q0VA== X-Gm-Message-State: ALyK8tJyQH6/wFSsExBuA+I3qFRSHi5XAyUYpyyGpqQpPimK3/6cmWm+Z9nTO9wbl0JTaKGgSXH2lqk80pIzFQ== X-Received: by 10.157.1.199 with SMTP id e65mr11822906ote.141.1467758452326; Tue, 05 Jul 2016 15:40:52 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: Xref: csiph.com comp.lang.python:111147 On Tue, Jul 5, 2016 at 6:29 PM, Seymore4Head wrote: > On Tue, 5 Jul 2016 18:27:25 -0400, Joel Goldstick > wrote: > >>On Tue, Jul 5, 2016 at 6:05 PM, Seymore4Head >> wrote: >>> import os >>> >>> f_in = open('win.txt', 'r') >>> f_out = open('win_new.txt', 'w') >>> >>> for line in f_in.read().splitlines(): >>> f_out.write(line + " *\n") >>> >>> f_in.close() >>> f_out.close() >>> >>> os.rename('win.txt', 'win_old.txt') >>> os.rename('win_new.txt', 'win.txt') >>> >>> >>> I just tried to reuse this program that was posted several months ago. >>> I am using a text flie that is about 200 lines long and have named it >>> win.txt. The file it creates when I run the program is win_new.txt >>> but it's empty. >>> >>> >>> -- >>> https://mail.python.org/mailman/listinfo/python-list >> >>Are you running program in same folder as text file? > > Yes. I just reinstalled Python. Python is not installed in the same > folder and I don't remember if it needs to have path entered. > > > -- > https://mail.python.org/mailman/listinfo/python-list So, if you type python, do you enter the python shell? -- Joel Goldstick http://joelgoldstick.com/blog http://cc-baseballstats.info/stats/birthdays