[BangPypers] How to handle files efficiently in python

2011-03-22 Thread briji...@gmail.com
Hi All,
How can I print last five lines of a file using python. The file may
contain thousands of lines each line may differ in length.


*
Regrads,

Brijith P
*
*
*
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] How to handle files efficiently in python

2011-03-22 Thread briji...@gmail.com
Hi,

I too answered this way to this question. I thought there may be some other
efficient way to handle this situation.

*
Regrads,
Brijith P

* 


On 22 March 2011 22:19, Noufal Ibrahim  wrote:

> On Tue, Mar 22 2011, briji...@gmail.com wrote:
>
> > Hi All,
> > How can I print last five lines of a file using python. The file
> may
> > contain thousands of lines each line may differ in length.
>
> [...]
>
> You'd have to use some kind of heuristic (a.k.a. dirty hack). Stat the
> file to find it's size and use an "average" length of line to go a few
> lines back. Then count the number of newlines from there to the end. If
> it's 4, then you have your 5 lines. Otherwise, seek back a little more
> and repeat.
>
> --
> ___
> BangPypers mailing list
> BangPypers@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] How to handle files efficiently in python

2011-03-22 Thread briji...@gmail.com
*
Regrads,

Brijith P
**NuCore Software Solutions Pvt Ltd*
*Mobile: +91 8089703840*
Url: *www.nucoreindia.com* <http://www.nucoreindia.com>
Email: *brij...@nucoreindia.com* 




On 23 March 2011 10:31, Gora Mohanty  wrote:

> On Wed, Mar 23, 2011 at 10:15 AM, briji...@gmail.com 
> wrote:
> > Hi,
> >
> > I too answered this way to this question. I thought there may be some
> other
> > efficient way to handle this situation.
> [...]
>
> Is this a question for students? Otherwise, what is the rationale
> of doing this in Python?
>

This a question asked by netApp


>
> Regards,
> Gora
> ___
> BangPypers mailing list
> BangPypers@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] python SVN delete functionality

2011-06-22 Thread briji...@gmail.com
@Shashidhar
*
*
 You mean the *svn delete* must work when you *svn update?. *Yes
we can do it. but its a tricky way. What I suggest is to create a
shell/python script named *svn *and put in higher path hierarchy (for
example /usr/local/bin). In side the script you code like if its ran with
argument other than *up* or *update* the run /usr/bin/svn . if
the argument is *update* or *up* you have to do your tasks like checking for
the removed files in the working copy and /usr/bin/svn delete the files you
got , and then you can run /usr/bin/svn update inside the script. :)

That means write a script to override the existing svn command.. this may
work.. try it..

Note:- Every svn command you use in side the script must contain absolute
path other wise it will end up in a looping call

*
Regards,
Brijith P
*
*
*



On Thu, Jun 23, 2011 at 12:34 AM, Noufal Ibrahim  wrote:

> Sriram Narayanan  writes:
>
> > There's also the python API to SVN which let's you d a lot of stuff.
>
> [...]
>
> The last time I checked (and it was a long time ago), it needed physical
> access to the repository file system (not just the checkout) to be able
> to do anything. That makes it useless for the OPs needs.
>
> --
> ~noufal
> http://nibrahim.net.in
>
> Thank God I'm an atheist.
> ___
> BangPypers mailing list
> BangPypers@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Creating a blog in Django 1.3 Screencasts

2012-03-07 Thread briji...@gmail.com
Nice screen Casts
Thank U

*
Regards,
Brijith P
*
*
*



On Wed, Mar 7, 2012 at 8:19 PM, Arun Ravindran  wrote:

> Hi all,
>
> Every since Django moved to 1.0, there have been very few screencasts about
> Django. It is quite hard for a beginner or even someone who has used Django
> to find a video tutorial adapted to the latest Django release. As a humble
> attempt to solve this gap, I have created two screencasts about building a
> blog in Django:
>
>
> http://arunrocks.com/blog/2012/03/05/building_a_blog_in_30_mins_with_django_%28screencast%29/
>
>
> http://arunrocks.com/blog/2012/03/07/bonus_html5_makeover_for_the_django_blog/
>
> Hope you find this useful.
>
> Thanks,
> Arun
> ___
> BangPypers mailing list
> BangPypers@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] executing shell commands through python script

2012-08-13 Thread briji...@gmail.com
try this. http://docs.python.org/library/commands.html

Regards,
Brijith P



On Tue, Aug 14, 2012 at 3:15 AM, Vikram K  wrote:
> i am able to run the following command from the shell (i am working on Mac
> Snow Leopard):
>
> cgatools evidence2sam --beta --evidence-dnbs
> evidenceDnbs-chr11-GS10026-ASM-T1.tsv.bz2 --reference build36.crr
> --output CGI_10026_CLL046_chr11_NUMA1_N.sam --extract-genomic-region
> chr11,71391559,71469221 --add-mate-sequence
>
> The command i give above executes perfectly and i get the desired results.
> Problem is that i need to execute variations of this command around two
> hundred times on the shell. Can i embed this command in a python script (i
> think one of the functions in the os module might be able to do what i
> want). Thanks.
> ___
> BangPypers mailing list
> BangPypers@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers