Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3a.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'read.': 0.03; 'problem?': 0.07; 'tries': 0.07; 'python': 0.11; 'def': 0.12; "'w')": 0.16; '(assuming': 0.16; 'better?': 0.16; 'competitors': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'header :User-Agent:1': 0.23; 'module,': 0.24; 'text.': 0.24; 'file.': 0.24; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'lines': 0.31; 'that.': 0.31; 'file': 0.32; 'text': 0.33; 'open': 0.33; 'third': 0.33; "can't": 0.35; 'received:84': 0.35; 'module.': 0.36; 'revert': 0.36; 'subject:?': 0.36; 'list': 0.37; 'list.': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'read': 0.60; "you're": 0.61; 'first': 0.61; 'back': 0.62; 'email addr:gmail.com': 0.63; 'fourth': 0.84; 'opens': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=JLW1sq6b c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=sASEtNAQL0YA:10 a=ihvODaAuJD4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=ZyKMv97ID9UA:10 a=pGLkceISAAAA:8 a=2FHp8gr3cnioVY4v3rUA:9 a=bYRUvOZLVijNvBSe:21 a=oKhfdhAnfzi9AToi:21 a=QEXdDO2ut3YA:10 a=MSl-tDqOz04A:10 X-AUTH: mrabarnett:2500 Date: Thu, 13 Feb 2014 18:25:16 +0000 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Wait... WHAT? References: <6c76ef4e-8c7c-4199-b30d-c4d55c1061c8@googlegroups.com> <20140212161427.0a9843d5@bigbox.christie.dr> <20140212184432.1df9b491@bigbox.christie.dr> <20140212212953.458b810a@bigbox.christie.dr> <8778c4cc-334b-4254-aed7-0f33acbf1d8f@googlegroups.com> In-Reply-To: <8778c4cc-334b-4254-aed7-0f33acbf1d8f@googlegroups.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392315920 news.xs4all.nl 2832 [2001:888:2000:d::a6]:43001 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66199 On 2014-02-13 17:46, eneskristo@gmail.com wrote: > Can we please revert back to the original problem? > def save(): > target = open ("save.swroc", 'w') This opens the file for writing text (assuming you're using Python 3). > target.write([counter, loop, number_of_competitors, competitors]) This tries to write a list to the file. You can't do that. A list isn't text. > def load(): > the_array = list(open("save.swroc", 'r')) This open the file for reading text. Using 'list' will make it read lines of text and return them as a list. > the_array = target What's 'target'? > counter = the_array[0] This will set 'counter' to the first line of text that was read. > loop = the_array[1] This will set 'loop' to the second line of text. > number_of_competitors = the_array[2] This will set 'number_of_competitors' to the third line of text. > competitors = the_array[3] This will set 'number_of_competitors' to the fourth line of text. > Is this better? > Not really! :-) Have a look at the "pickle" module, or the "json" module.