Advise of programming one of my first programs

Anatoli Hristov tolidtm at gmail.com
Tue Mar 27 17:53:42 EDT 2012


Thanks, but I`m still far from for dose details I thing:)
Regards
Anatoli
On Tue, Mar 27, 2012 at 5:53 PM, Tim Chase <python.list at tim.thechases.com>wrote:
> On 03/27/12 10:32, Prasad, Ramit wrote:
>>> 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<http://docs.python.org/release/2.5.2/lib/pickle-example.html>
>>>> Or, depending on the use, you might use ast.literal_eval()
>> A cursory glance at the OP's code suggests that this may simply be a dict
> of values-to-lists of purely literals, so literal_eval() should do the job.
>> -tkc
>>> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120327/0146b400/attachment-0001.html>


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /