> Ramit,
>
> This seems to be more logic now "I hope" :)
> #
> import ast
> fname = 0
> lname = 1
> country = 2
> city = 3
> tel = 4
> notes = 5
>
> ## Read data from file
>
> def load_book():
> load_book = open('c:/Python27/Toli/myfile.txt', 'r')
>
Ramit,
This seems to be more logic now "I hope" :)
#
import ast
fname = 0
lname = 1
country = 2
city = 3
tel = 4
notes = 5
## Read data from file
def load_book():
load_book = open('c:/Python27/Toli/myfile.txt', 'r')
load_book = ast.literal_eval(loa
>
> **
>
> Absolutely! Too bad your version would be considered the more
> “complicated” version ;)
>
I`m sure about that, but I`am also sure that every beginner passed true
that way.
>
>
> ** **
>
> >With the main navigation menu I will only have the option to select a
> nickname and when a
>>From the Zen of Python, "Simple is better than complex." It is a good
>>programming
mentality.
>Complex is better than complicated. :p
Absolutely! Too bad your version would be considered the more “complicated”
version ;)
>With the main navigation menu I will only have the option to select a
From: Anatoli Hristov [mailto:toli...@gmail.com]
Sent: Wednesday, March 28, 2012 5:36 PM
To: Prasad, Ramit
Cc: python-list@python.org
Subject: Re: RE: Advise of programming one of my first programs
>>> > Um, at least by my understanding, the use of Pickle is also dangerous if
>&g
Thu, Mar 29, 2012 at 9:36 AM, Anatoli Hristov wrote:
>> > > Um, at least by my understanding, the use of Pickle is also dangerous
>> > > if you are not completely sure what is being passed in:
>> >
>> > Oh goodness yes. pickle is exactly as unsafe as eval is. Try running
>> > this code:
>> >
>> >
> > Um, at least by my understanding, the use of Pickle is also dangerous if
> > you
> > > are not completely sure what is being passed in:
> >
> > Oh goodness yes. pickle is exactly as unsafe as eval is. Try running this
> > code:
> >
> > from pickle import loads
> > loads("c__builtin__\neval\n(c_
> You are correct it is not. :) You code is overly complex making it harder
> to understand. Try and reduce the problem to the least number of tasks you
> need.
> >From the Zen of Python, "Simple is better than complex." It is a good
> programming
> mentality.
Complex is better than complicated.
> >> 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 complet
On Tue, Mar 27, 2012 at 5:59 PM, Evan Driscoll wrote:
>> 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
On 03/27/12 16:53, Anatoli Hristov wrote:
On Tue, Mar 27, 2012 at 5:53 PM, Tim Chase 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 pas
> def load_book():
> load_book = open('c:/Python27/Toli/myfile.txt', 'r')
> load_book = eval(load_book.read())
> return load_book
> def write_book(tbook):
> write_book = open('c:/Python27/Toli/myfile.txt', 'w')
> write_book.write(str(tbook))
>
> def details(choice):
> s
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
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 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 danger
>
> This was difficult, now I feel more confused it works, but I`m sure its
> not the way you wanted :)
> 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
>
> I`m s
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
It is considered polite to post your reply either after the quoted text
or interspersed as I have done below.
> By the way I dont know why your mail was in my junk I just saw it.
Probably because I only reply back to the list and let the list
forward to you.
> And here is my last code I did for
Thank you Ramit for your advice`s. I`m reading a book ( Learning Python,
Second Edition ) by Mark Lutz and David Ascher and now I just finished the
Basic Function lesson :) I will keep in mind what you have advised me, but
will implement it later when I have more experience with the book, because
I
> Hi guys just wanted to share one of my first programs. Could you please
> tell me, do I use a right logic ?
> It works fine what I wanted to do, but is it writen in the right way? My
> next step is to make it write the changes of the dictionary on the file :)
>
When you do get that far, you sh
19 matches
Mail list logo