[Tutor] Compute data usage from log

2009-10-26 Thread bibi midi
Hi all!

I have a file with data structure derived from wvdial log:
Oct 14 11:03:45 cc02695 pppd[3092]: Sent 3489538 bytes, received
43317854 bytes.

I want to get the 10th field of each line and get the sum for all lines
(total my net data usage). In awk u can easily pop it using field variables
e..g $10. Since im learning python on my own i thought this is a good way to
learn but im stumped how to achieve this goal.
I used open() and read line method to store the contents in a list but it is
a list of string. I need it to be numbers. Iterating through the string list
definitely is unwieldy. Can you guys advise best way how?

FWIW im a self learner and just relying from tutorial materials and this
medium to learn python. Lead me to the right direction please :-)

My IDE is vim and ipython in debian linux.


-- 
Best Regards,
bibimidi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Compute data usage from log

2009-10-26 Thread bibi midi
On Mon, Oct 26, 2009 at 2:12 PM, Luke Paireepinart
wrote:

>
>
> On Mon, Oct 26, 2009 at 3:20 AM, Christian Witts 
> wrote:
>
>> fInput = open('/path/to/log.file', 'rb')
>> total_usage = 0
>> for line in fInput:
>>   total_usage += int(line.split(' ')[9].strip())
>> print total_usage
>>
>
> It's actually bad to assign a variable to the file object in this case
> (flinput = ) because Python will automatically close a file after you're
> done with it if you iterate over it directly, but if you include a reference
> it will stay open until the python program ends or you explicitly call
> flinput.close().  It doesn't matter much in this example but in general it
> is good practice to either
> 1) call foo.close() immediately after you're done using a file object, or
> 2) don't alias the file object and just over it directly so Python will
> auto-close it.
>
> Therefore a better (and simpler) way to do the above would be:
>
> total_usage = 0
> for line in open('/path/to/log.file'):
> total_usage += int(line.split(' ')[9])
>

Hi Luke,

Your modification seems cleaner, you called the open function directly in
the for loop.


>
> Also note you don't need to strip the input because int() coersion ignores
> whitespace anyway. And additionally you shouldn't be opening this in binary
> mode unless you're sure you want to, and I'm guessing the log file is ascii
> so there's no need for the 'rb'.  (reading is default so we don't specify an
> 'r'.)
>

The file is normal ascii text. Ii open it with no mode set, and that
defaults to read-only.


>
> And since I like list comprehensions a lot, I'd probably do it like this
> instead:
>
> total_usage = sum([int(line.split(' ')[9]) for line in
> open('/path/to/log.file')])
>
> Which incidentally is even shorter, but may be less readable if you don't
> use list comprehensions often.
>
> Also, the list comprehension version is likely to be more efficient, both
> because of the use of sum rather than repeated addition (sum is implemented
> in C) and because list comprehensions in general are a tad faster than
> explicit iteration, if i recall correctly (don't hold me to that though, I
> may be wrong.)
>

I have read up on list comprehension and I seem to understand it's basics. I
will play around with the different solutions on hand.


>
>> Of course this has no error checking and or niceties, but I will leave
>> that up to you.
>
> The same applies to my modifications.
>
> Good luck, and let us know if you need anything else!
>
> -Luke
>

Thank you as always :-)


-- 
Best Regards,
bibimidi

Sent from Riyadh, 01, Saudi Arabia
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Compute data usage from log

2009-10-27 Thread bibi midi
#!/usr/bin/env python
# -*- coding: utf-8 -*-

'''
Calculate internet data consumption
of service provider
Code as per help of python tutor mailing list
Created: 26-Oct-2009
'''

intro = raw_input('press enter to view your internet data consumption: ')
log_file = '/home/bboymen/mobily.data.plan'
total_consumed = 0
for line in open(log_file):
total_consumed += int(line.split(' ')[9])

total_consumed = total_consumed/100.0
print "total data consumed is: %0.3f MB\n" % total_consumed


#TODO:
#1) show the list comprehension alternative method
#2) add exception handling e.g. when log_file cant be found or when
key interrupt is pressed
#  or when index[9] is not a number, etc
#3) print latest date of calculated data


I'm working on TODO no. 3 e.g. I want to show the latest date when wvdial
generated the ppp data. This is normally the date of last line of the ppd:

Oct 14 11:03:45 cc02695 pppd[3092]: Sent 3489538 bytes, received
43317854 bytes.
^

For the exception handling i *think* i just use the general exception method
e.g. will catch all kinds of error. I really dont know what other errors
will show up aside from the ones i listed in the TODO. Advise is
appreciated.





On Mon, Oct 26, 2009 at 2:12 PM, Luke Paireepinart
wrote:

>
>
> On Mon, Oct 26, 2009 at 3:20 AM, Christian Witts 
> wrote:
>
>> fInput = open('/path/to/log.file', 'rb')
>> total_usage = 0
>> for line in fInput:
>>   total_usage += int(line.split(' ')[9].strip())
>> print total_usage
>>
>
> It's actually bad to assign a variable to the file object in this case
> (flinput = ) because Python will automatically close a file after you're
> done with it if you iterate over it directly, but if you include a reference
> it will stay open until the python program ends or you explicitly call
> flinput.close().  It doesn't matter much in this example but in general it
> is good practice to either
> 1) call foo.close() immediately after you're done using a file object, or
> 2) don't alias the file object and just over it directly so Python will
> auto-close it.
>
> Therefore a better (and simpler) way to do the above would be:
>
> total_usage = 0
> for line in open('/path/to/log.file'):
> total_usage += int(line.split(' ')[9])
>
> Also note you don't need to strip the input because int() coersion ignores
> whitespace anyway. And additionally you shouldn't be opening this in binary
> mode unless you're sure you want to, and I'm guessing the log file is ascii
> so there's no need for the 'rb'.  (reading is default so we don't specify an
> 'r'.)
>
>
> And since I like list comprehensions a lot, I'd probably do it like this
> instead:
>
> total_usage = sum([int(line.split(' ')[9]) for line in
> open('/path/to/log.file')])
>
> Which incidentally is even shorter, but may be less readable if you don't
> use list comprehensions often.
>
> Also, the list comprehension version is likely to be more efficient, both
> because of the use of sum rather than repeated addition (sum is implemented
> in C) and because list comprehensions in general are a tad faster than
> explicit iteration, if i recall correctly (don't hold me to that though, I
> may be wrong.)
>
>>
>> Of course this has no error checking and or niceties, but I will leave
>> that up to you.
>
> The same applies to my modifications.
>
> Good luck, and let us know if you need anything else!
>
> -Luke
>



-- 
Best Regards,
bibimidi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Compute data usage from log

2009-10-27 Thread bibi midi
Hey Christian,

There seems to be a missing parenthesis in your join function below. Correct
me if I'm wrong.

I can live with ppp's time format for now. My script is not world-changing
anyway :-). How do i know I'm on the last line of the log file per the code
below? Just asking as I'm away from my linux box atm.

for line in open(log_file):
last_log_date = ' '.join(line.split(' ')[:3])

Thanks.


On Tue, Oct 27, 2009 at 2:56 PM, Christian Witts wrote:

> bibi midi wrote:
>
>> #!/usr/bin/env python
>> # -*- coding: utf-8 -*-
>>
>> '''
>> Calculate internet data consumption
>> of service provider
>> Code as per help of python tutor mailing list
>> Created: 26-Oct-2009
>>
>> '''
>>
>> intro = raw_input('press enter to view your internet data consumption: ')
>> log_file = '/home/bboymen/mobily.data.plan'
>> total_consumed = 0
>> for line in open(log_file):
>>total_consumed += int(line.split(' ')[9])
>>
>>
>> total_consumed = total_consumed/100.0
>> print "total data consumed is: %0.3f MB\n" % total_consumed
>>
>>
>> #TODO: #1) show the list comprehension alternative method
>> #2) add exception handling e.g. when log_file cant be found or when key
>> interrupt is pressed
>>
>> #  or when index[9] is not a number, etc
>> #3) print latest date of calculated data
>>
>> I'm working on TODO no. 3 e.g. I want to show the latest date when wvdial
>> generated the ppp data. This is normally the date of last line of the ppd:
>>
>> Oct 14 11:03:45 cc02695 pppd[3092]: Sent 3489538 bytes, received
>> 43317854 bytes.
>> ^
>>
>> For the exception handling i *think* i just use the general exception
>> method e.g. will catch all kinds of error. I really dont know what other
>> errors will show up aside from the ones i listed in the TODO. Advise is
>> appreciated.
>>
>>
>>
>>
>>
>> On Mon, Oct 26, 2009 at 2:12 PM, Luke Paireepinart <
>> rabidpoob...@gmail.com <mailto:rabidpoob...@gmail.com>> wrote:
>>
>>
>>
>>On Mon, Oct 26, 2009 at 3:20 AM, Christian Witts
>>mailto:cwi...@compuscan.co.za>> wrote:
>>
>>fInput = open('/path/to/log.file', 'rb')
>>total_usage = 0
>>for line in fInput:
>>  total_usage += int(line.split(' ')[9].strip())
>>print total_usage
>>
>>
>>It's actually bad to assign a variable to the file object in this
>>case (flinput = ) because Python will automatically close a
>>file after you're done with it if you iterate over it directly,
>>but if you include a reference it will stay open until the python
>>program ends or you explicitly call flinput.close().  It doesn't
>>matter much in this example but in general it is good practice to
>>either
>>1) call foo.close() immediately after you're done using a file
>>object, or
>>2) don't alias the file object and just over it directly so Python
>>will auto-close it.
>>
>>Therefore a better (and simpler) way to do the above would be:
>>
>>total_usage = 0
>>for line in open('/path/to/log.file'):
>>total_usage += int(line.split(' ')[9])
>>
>>Also note you don't need to strip the input because int() coersion
>>ignores whitespace anyway. And additionally you shouldn't be
>>opening this in binary mode unless you're sure you want to, and
>>I'm guessing the log file is ascii so there's no need for the
>>'rb'.  (reading is default so we don't specify an 'r'.)
>>
>>
>>And since I like list comprehensions a lot, I'd probably do it
>>like this instead:
>>
>>total_usage = sum([int(line.split(' ')[9]) for line in
>>open('/path/to/log.file')])
>>
>>Which incidentally is even shorter, but may be less readable if
>>you don't use list comprehensions often.
>>
>>Also, the list comprehension version is likely to be more
>>efficient, both because of the use of sum rather than repeated
>>addition (sum is implemented in C) and because list comprehensions
>>in general are a tad faster than explicit iteration, if i recall
>>correctly (don't hold me to that though, I may be wrong.)
>>
>>
>>  

Re: [Tutor] Compute data usage from log

2009-10-27 Thread bibi midi
Yep it works! I understand now it iterates on each line and replaces the old
elements with the new ones. In the end you get the latest date of the last
line of log.

I will work on the exception handling and other refinements. Thanks.



On Tue, Oct 27, 2009 at 8:41 AM, Christian Witts wrote:

>
>
>>for line in open(log_file):
>>  last_log_date = ' '.join(line.split(' ')[:3]
>>
>>which would take the first 3 elements in your list and combine
>>them again.  Of course this is again just a simple representation
>>of what to do.
>>
>>--Kind Regards,
>>Christian Witts
>>
>>
>>
>>
>>
>> --
>> Best Regards,
>> bibimidi
>>
>> Sent from Riyadh, 01, Saudi Arabia
>>
>
>
> Hi Bibi,
>
> Yeah there was a missing parenthesis, I was just typing away.
> As for knowing if you're on the last line of your log file, basically what
> will happen is for every line you iterate through it will parse the first 3
> elements of your line and use that for the last_log_date.
> If you know for certain that every line will start with the time stamp then
> it will work fine, if that is not the case then you will need to build in
> some checking to ensure you get the correct information.
>
> --
> Kind Regards,
> Christian Witts
>
>
>


-- 
Best Regards,
bibimidi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Local vs global

2009-11-07 Thread bibi midi
On Sat, Nov 7, 2009 at 3:26 PM, Dave Angel  wrote:
> Alan Gauld wrote:
>>
> Alan - Excellent comments, as usual.
>
> bibimidi - I would point out that after you remove the 'global choose'
line
> as Alan said, you should rename the global variable you're using to store
> the return value.  They're allowed to have the same name, but it's
confusing
> to a beginner if they do, since you might assume they somehow share the
> value.
>

Thank you all for the helpful insights. I will keep in mind the naming
rules in Python, so as not to have it in collision with Python's
builtins.

The mention to tidy up e.g. "compartmentalize" code is also noted. I
agree definitely.

I'm reworking my code and will post back.




--
Best Regards

Marie von Ebner-Eschenbach  - "Even a stopped clock is right twice a
day." -
http://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html



-- 
Best Regards,
bibimidi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Local vs global

2009-11-08 Thread bibi midi
On Sun, Nov 8, 2009 at 6:20 AM, bibi midi  wrote:


> Thank you all for the helpful insights. I will keep in mind the naming
> rules in Python, so as not to have it in collision with Python's
> builtins.
>
> The mention to tidy up e.g. "compartmentalize" code is also noted. I
> agree definitely.
>
> I'm reworking my code and will post back.
>

For reason unknown to me the script dont repeat itself
when asked if to play again or not no matter what juggling of the
while/if conditionals i do, the result is the same. What am i
missing?

Also, I'm not sure I'm right in the assignment ans = choose_Cave.
I code it like so because the assignment ans = choose_Cave()
the prompt 'Choose a cave' is repeated when the script is run.
Dont want this. I tested this when run in ipython.

I dont know if there is a way to just retrieve the return value to a
variable AND not run the whole function i mean in the case of
ans = choose_Cave(). Would love to hear your expert insights by return.

http://paste.debian.net/51004/


-- 
Best Regards,
bibimidi


On Sat, Nov 7, 2009 at 3:26 PM, Dave Angel  wrote:
> Alan Gauld wrote:
>>
> Alan - Excellent comments, as usual.
>
> bibimidi - I would point out that after you remove the 'global choose'
line
> as Alan said, you should rename the global variable you're using to store
> the return value.  They're allowed to have the same name, but it's
confusing
> to a beginner if they do, since you might assume they somehow share the
> value.
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Local vs global

2009-11-08 Thread bibi midi
On Sun, Nov 8, 2009 at 8:38 AM, Dave Angel  wrote:
>
> You have the following line at top-level:
>
>   if ask.lower not in reply:
>
> But you're not calling the method str.lower(), you're just creating a
> function object from it.  You need those parentheses.
>
>   if ask.lower() not in reply:
>
>
> You have the following fragment in main():
>
>   print(intro)
>   choose_Cave()
>   ans = choose_Cave# use: pass function by reference
>   checkCave(ans)
>
>
> which has two references to choose_Cave().  The first one calls it, but
> throws away the return value.  The second does not call it at all, but
> merely creates a function object and stores it in ans.  You need to
combine
> your two intents in one line:
>
>   print(intro)
>   ans = choose_Cave()# use: pass function by reference
>   checkCave(ans)
>
> Hope that helps.  Remember, that unlike Pascal, in Python you don't call
the
> function unless you include the parentheses.

Hi Dave and all,

My eyes failed me spotting the bugs :-) They are just staring at me
yet i miss to catch them. I guess thats the net result when one take
it too seriously haha (joke).

I fully agree function is not called when the parenthesis is missing,
you only call the object. About Pascal or VB i cant comment on them
:-)

The code works as expected now. I guess i have to move on to the other
examples.

Will be back here to bug you guys with questions :-) Thank you for so
helpful.


--
Best Regards

Jonathan Swift  - "May you live every day of your life." -
http://www.brainyquote.com/quotes/authors/j/jonathan_swift.html



-- 
Best Regards,
bibimidi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Should a beginner learn Python 3.x

2009-11-14 Thread bibi midi
On Sun, Nov 15, 2009 at 10:37 AM, wesley chun  wrote:

> >> My brother in law is learning python.  He's downloaded 3.1 for
> >> Windows, and is having a play.  It's already confused him that print
> >> "hello world" gives a syntax error
> >>
> >> He's an absolute beginner with no programming experience at all.  I
> >> think he might be following 'Python Programming for the Absolute
> >> Beginner", or perhaps some online guides.  Should I advise him to
> >> stick with 2.6 for a bit, since most of the material out  there will
> >> be for 2.x?  Or since he's learning from scratch, should he jump
> >> straight to 3.x
>
>
> good question, and already well-answered by most. i'll chime in with a
> few remarks too. basically, if he is really starting from scratch,
> i.e., no preexisting codebase, not using it for work, etc., then
> there's no harm in starting using 3.x as long as you give the caveat
> that most tutorials and source out there is still 2.x. 3.x has not
> gained widespread adoption yet because not all of the lower-level (nor
> higher-level) libraries, packages, and modules have been ported to 3.x
> yet.
>
> i gave a talk recently about this very topic (
> http://siliconvalley-codecamp.com/Sessions.aspx?OnlyOne=true&id=227 )
> and will repeat it again at PyCon 2010 in Atlanta (
> http://us.pycon.org/2010/conference/talks -- see session #48 ).
>
> i get asked this question a lot, esp. when it pertains to my book,
> "Core Python Programming." which should i learn? is your book
> obsolete? etc. i basically tell them that even though they are
> backwards-incompatible, it's not like Python 2 and 3 are so
> different that you wouldn't recognize the language anymore! as Kris
> has said, there are just a handful of noticeable difference that you
> have to just keep in mind. finally, the next edition of the book will
> definitely be BOTH Python 2 and 3. Python 2 isn't EOL'd and will be
> around for awhile longer -- the most important evidence of this being
> that both 2.x and 3.x are being developed in parallel.
>
> hope this helps!
> -- wesley
>


I just ordered your great book 2nd edition. I dont know if i should get
worried using a dated version. All i want is to learn the language. The
transition process (i think) should just follow normally once you learn the
language. So far I'm just a newbie trying to learn.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] I love python / you guys :)

2009-11-16 Thread bibi midi
On Mon, Nov 16, 2009 at 1:58 AM, Stefan Lesicnik  wrote:

> hi,
>
> Although not a question, i just want to tell you guys how awesome you are!
>
> I am not a programmer, i can do a bit of bash. I have never officially
> learnt programming, but numerous times looked at some perl, c, java
> and never really gotten past the beginning stages of it. That all
> changed when i picked up python. Although my style and use of python
> is probably barbaric at best, I really enjoy it when you can make
> things work. Python was just amazing from a readability / logical
> point of view. If i can think of something, there is a way to do it in
> python. After learning the simple data structures it seems i can
> really do anything i want to.
>


Hi Stefan,

Your message mirrored my current state. There's TONS to learn in linux like
bash, perl, vim, sed, awk, python, etc. Too much to put in your head and in
the end makes you half-baked e.g. good at start but fades away in the end.
Anyway i hope to follow your lead and be one among the guys here
knowledgeable of the language.

In the same lines of if-you-can-think-of-anything-python-can-do-it i got
inspired to ask a question for the gurus:

When i use our company's LAN i set my proxy variable by hand in .bashrc.
There are 4 files to insert proxy variable:

in ~/.bashrc, /root/.bashrc, /etc/wgetrc and /etc/apt/apt.conf.

The last one is actually rename e.g. mv to apt.conf to activate proxy and mv
to apt.conf.bak to deactivate. The proxy variable is something like this

export http_proxy=http://username:passw...@proxy:port
ftp_proxy=$http_proxy

To activate i uncomment them then source .bashrc. To deactivate i put back
the comment sign. I do it all in vim e.g. vim -o the-3-files-above. For
apt.conf see rename above. I deactivate because i have another internet
connection option via 3G usb modem. But thats another story.

I will do this myself in python so please show me the way. Surely this can
be done.



-- 
Best Regards,
bibimidi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] proxy switcher - was Re: I love python / you guys :)

2009-11-17 Thread bibi midi
Hi guys!

Thank you all for the brainstorming. As much as i love to follow all your
tips but sorry I got lost in the sea of discussion :-) Therefore i thought i
start to roll out my own and i hope you guys can chime in.

The print lines in my code are just for debugging. Of course they can be
omitted but for a newbie like me I helps to see what I'm doing is what I'm
expected to do.

I would like to improve my line search with the module re but cant find
something to get me started. I appreciate if you can show me how. The
'proxy' search works but I'm sure with re module the search will be definite
i mean wont yield 'false positive' result, sort-of.

http://pastebin.ca/1675865


-- 
Best Regards,
bibimidi

Sent from Dhahran, 04, Saudi Arabia
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] proxy switcher - was Re: I love python / you guys :)

2009-11-19 Thread bibi midi
-- Forwarded message --
From: bibi midi 
Date: Tue, Nov 17, 2009 at 11:12 PM
Subject: Re: [Tutor] proxy switcher - was Re: I love python / you guys :)
To: Dave Angel 
Cc: Luke Paireepinart , tutor 


Hi guys!

Thank you all for the brainstorming. As much as i love to follow all your
tips but sorry I got lost in the sea of discussion :-) Therefore i thought i
start to roll out my own and i hope you guys can chime in.

The print lines in my code are just for debugging. Of course they can be
omitted but for a newbie like me I helps to see what I'm doing is what I'm
expected to do.

I would like to improve my line search with the module re but cant find
something to get me started. I appreciate if you can show me how. The
'proxy' search works but I'm sure with re module the search will be definite
i mean wont yield 'false positive' result, sort-of.

http://pastebin.ca/1675865


-- 
Best Regards,
bibimidi

Sent from Dhahran, 04, Saudi Arabia



-- 
Best Regards,
bibimidi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread bibi midi
Thanks to all of you that replied. Your inputs are very helpful and
informative.


On Tue, Dec 1, 2009 at 12:14 AM, Sander Sweers wrote:

>
> There is no exception to alert you a file already exists. Depending on
> how you open the file (mode) it will either read, write or append to
> the file. If the file exists and you open it in write mode it *will*
> overwrite the file. See [1] for more info.
>
> So what you need to do is check yourself if the file exists and make
> the python script take appriate action. For example:
>
> import os
> fname = "C:\\testfile.txt"
> if os.path.exists(fname):
>do something if exists
> else:
>   do something else if not exists
>
> Greets
> Sander
>

Like i thought so, there is no exception to catch if a file already exist.
I've been browsing the many types of exceptions and cant find anything thats
close. Thank you for clarifying.

I may have misunderstood the exercise question and will have to return to it
to do another approach.

For the record below is the working copy of the script. Here i understand
how the os.path.exists() method works.

while True:
fname = raw_input('please enter filename: ')
if os.path.exists(fname):
print('ERROR: %s exists!') % fname
elif fname.isspace():
print('Space is not allowed!')
else:
print('you entered %s') % fname
break

all = []# container list to hold user input lines
print "\nPopulate your file! \n"
quit_prompt = "[to quit enter a dot '.' by itself]--> "

while True:
entry = raw_input(quit_prompt)
if entry == '.':
break
else:
all.append(entry)

confirm = raw_input('save file to disk?(y/N)')
confirm = confirm.lower()   #convert to lowercase
if confirm == 'y':
fobj = open(fname, 'w')
fobj.write('\n'.join(all))
fobj.close()
print('DONE! open %s to view your file') % fname
else:
print 'not saving to disk!'
sys.exit()

Thank you.


-- 
Best Regards,
bibimidi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Read-create-edit file

2009-12-13 Thread bibi midi
On Mon, Dec 14, 2009 at 1:17 AM, Rich Lovely wrote:

>
> First of all it's too long to paste into an email, especially if
> you'rte using a client that strips leading whitespace.  Paste it into
> a pastebin.  I personally prefer python.codepad.org, as it lets you
> test code on the server, unless it depends on third party modules.
>
> Uplaod it to a pastebin, send us the link, and we might consider taking a
> look.
>
>
>
>
Yes my bad, found out too late all



> --
> Rich "Roadie Rich" Lovely
>
> There are 10 types of people in the world: those who know binary,
> those who do not, and those who are off by one.
>



-- 
Best Regards,
bibimidi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Read-create-edit file

2009-12-13 Thread bibi midi
On Mon, Dec 14, 2009 at 6:09 AM, bibi midi  wrote:

>
>
> On Mon, Dec 14, 2009 at 1:17 AM, Rich Lovely wrote:
>
>>
>> First of all it's too long to paste into an email, especially if
>> you'rte using a client that strips leading whitespace.  Paste it into
>> a pastebin.  I personally prefer python.codepad.org, as it lets you
>> test code on the server, unless it depends on third party modules.
>>
>> Uplaod it to a pastebin, send us the link, and we might consider taking a
>> look.
>>
>>
>>
>>
 Yes my bad, found out too late. Sorry for that. Will post in pastebin or
equal and give the link.


-- 
Best Regards,
bibimidi

Sent from Riyadh, 01, Saudi Arabia
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Read-create-edit file

2009-12-13 Thread bibi midi
Here's the link:

http://paste.debian.net/53933/

On Mon, Dec 14, 2009 at 6:10 AM, bibi midi  wrote:

>
>
>  Yes my bad, found out too late. Sorry for that. Will post in pastebin or
> equal and give the link.
>
>
> --
> Best Regards,
> bibimidi
>
>

-- 
Best Regards,
bibimidi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor