Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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.073 X-Spam-Evidence: '*H*': 0.85; '*S*': 0.00; 'cc:addr:python-list': 0.15; 'eval': 0.16; 'subject:programming': 0.16; 'module': 0.18; 'passed': 0.20; 'wrote:': 0.21; 'header:In-Reply-To:1': 0.22; 'header:User-Agent:1': 0.23; 'cc:addr:python.org': 0.27; 'least': 0.27; 'pm,': 0.28; 'source.': 0.29; 'code': 0.29; 'to:2**1': 0.30; 'cc:2**0': 0.31; 'in.': 0.33; 'in:': 0.33; 'url:python': 0.34; 'sure': 0.36; 'url:library': 0.36; 'url:org': 0.36; 'data': 0.38; 'skip:0 10': 0.38; 'being': 0.39; 'secure': 0.61; 'url:5': 0.67; 'url:release': 0.84 Date: Tue, 27 Mar 2012 16:59:58 -0500 From: Evan Driscoll User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: "Prasad, Ramit" Subject: Re: RE: Advise of programming one of my first programs References: <5B80DD153D7D744689F57F4FB69AF4740928C365@SCACMX008.exchad.jpmchase.net> <5B80DD153D7D744689F57F4FB69AF4740928E137@SCACMX008.exchad.jpmchase.net> In-Reply-To: <5B80DD153D7D744689F57F4FB69AF4740928E137@SCACMX008.exchad.jpmchase.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Seen-By: mailfromd 4.1 sandstone.cs.wisc.edu Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1332885612 news.xs4all.nl 6920 [2001:888:2000:d::a6]:33046 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:22254 On 01/-10/-28163 01:59 PM, Prasad, Ramit wrote: >> ####### CODE ######### >> fileread = open('myfile.txt','r') >> tbook = eval(fileread.read()) >> fileread.close() > > The use of eval is dangerous if you are not *completely* sure what is > being passed in. Try using pickle instead: > http://docs.python.org/release/2.5.2/lib/pickle-example.html Um, at least by my understanding, the use of Pickle is also dangerous if you are not completely sure what is being passed in: Warning: The pickle module is not intended to be secure against erroneous or maliciously constructed data. Never unpickle data received from an untrusted or unauthenticated source. - http://docs.python.org/library/pickle.html Evan