Issue with CSV

2007-07-18 Thread Rohan
Hello,
I'm working on a script which collects some data and puts into a csv
file which could be exported to excel.
so far so good, I'm able to do what I described.
When I run the script for the second time after a certain period of
time the results should appear next to the results of the last run,
I'm unable to make a new column when the script is run after the first
time.
Ideally I would like to have an output which looks like this.
1/20   1/27
we.pywe.py
gh.pygj.py   <- Indicating tht the file has changed
fg.pyfg.py

Please help me out.
Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


CSV Issues

2007-07-18 Thread Rohan
Hello,
I'm working on a script which collects some data and puts into a csv
file which could be exported to excel.
so far so good, I'm able to do what I described.
When I run the script for the second time after a certain period of
time the results should appear next to the results of the last run,
I'm unable to make a new column when the script is run after the first
time.
Ideally I would like to have an output which looks like this.
1/20   1/27
we.pywe.py
gh.pygj.py   <- Indicating tht the file has changed
fg.pyfg.py

Please help me out.
Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


CSV Issue

2007-07-26 Thread Rohan
I'm having a  trouble consider this

import csv
f = open("/home/t/tp/va/some7.csv", "rb")
reader =csv.reader(f)
rows =[]
for row in reader:
   rows.append(row)



rows[1].append('1')

print rows
f = open("/home/t/tp/va/e7.csv", "ab")
writer =csv.writer(f)

writer.writerows(rows)
f.close()

In the file some7.csv there is already some data like this
1
2
3
4
Now i'm trying to add a '1' in row2 so that data can be like this
1
2,1
3
4
Instead i'm getting like this
1
2
3
4
1
2,1
3
4

can some one explain this and how to get it in the way i want it/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: CSV Issue

2007-07-26 Thread Rohan
On Jul 26, 2:32 pm, John Machin <[EMAIL PROTECTED]> wrote:
> On Jul 27, 7:19 am, Rohan <[EMAIL PROTECTED]> wrote:
>
> > f = open("/home/t/tp/va/e7.csv", "ab")
>
> a means Append -- you are appending the data that you expect to the
> EXISTING contents of the file.

Hello John,
Yea silly mistake, write mode will do.
thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Directory

2007-07-30 Thread Rohan

I would like to get a list of sub directories in a directory.
If I use os.listdir i get a list of directories and files in that .
i only want the list of directories in a directory and not the files
in it.
anyone has an idea regarding this.

-- 
http://mail.python.org/mailman/listinfo/python-list


Email

2007-08-02 Thread Rohan
I was wondering if there could be an arrangement where a file could be
attached and send as an email.
For ex
f = open(add.txt,w)
f.write('python')
f.close()

Now I would like to send an email with add.txt as an attachment, is it
possible ?
some one give me a pointer towards this.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email

2007-08-03 Thread Rohan
On Aug 2, 1:06 pm, Laurent Pointal <[EMAIL PROTECTED]> wrote:
> Rohan wrote:
> > I was wondering if there could be an arrangement where a file could be
> > attached and send as an email.
> > For ex
> > f = open(add.txt,w)
> > f.write('python')
> > f.close()
>
> > Now I would like to send an email with add.txt as an attachment, is it
> > possible ?
> > some one give me a pointer towards this.
>
> You can use iMailer as an example script to get parts:
>
> http://nojhan.free.fr/article.php3?id_article=22
>
> A+
>
> Laurent.


Laurent the link you gave me is in a language unknown to me if you
have anything that expalains in english, then let me know.
thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Auto run/Timer

2007-08-04 Thread Rohan
Hello,
I would like my script to run once a week with out any external
interference.
More like a timer. Can it be done in python or should some other shell
scripting be used.
If anyone knows anything please let me know.

-- 
http://mail.python.org/mailman/listinfo/python-list


Dealing with multiple excel sheets

2007-08-07 Thread Rohan
Hello,
I would like to write a script which does the following job.
Take column1 and 7 from 10 different excel sheets and pasthe them into
a new excel worksheet.
Any ideas on how to do it
Thanks,

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email

2007-08-07 Thread Rohan
On Aug 3, 7:22 pm, SMERSH009 <[EMAIL PROTECTED]> wrote:
> On Aug 3, 9:47 am,Rohan<[EMAIL PROTECTED]> wrote:
>
>
>
> > On Aug 2, 1:06 pm, Laurent Pointal <[EMAIL PROTECTED]> wrote:
>
> > >Rohanwrote:
> > > > I was wondering if there could be an arrangement where a file could be
> > > > attached and send as an email.
> > > > For ex
> > > > f = open(add.txt,w)
> > > > f.write('python')
> > > > f.close()
>
> > > > Now I would like to send an email with add.txt as an attachment, is it
> > > > possible ?
> > > > some one give me a pointer towards this.
>


> > > You can use iMailer as an example script to get parts:
>
> > >http://nojhan.free.fr/article.php3?id_article=22
>
> > > A+
>
> > > Laurent.
>
> > Laurent the link you gave me is in a language unknown to me if you
> > have anything that expalains in english, then let me know.
> > thanks
>
> Did you try Google translate?  Here is the tiny url of the page you
> wanted translatedhttp://tinyurl.com/3xlcmc

Thanks everyone,
I'm able to write a script which reads the file and puts it in the
message. I would like to attach the file is it possible?

-- 
http://mail.python.org/mailman/listinfo/python-list


Colored text

2007-08-12 Thread Rohan
Hello,
Can some one tell me how do I get colored text. Say when I want to
write something in a text file , how do I get it colored.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Colored text

2007-08-12 Thread Rohan
On Aug 12, 10:01 pm, ianaré <[EMAIL PROTECTED]> wrote:
> On Aug 12, 10:05 pm, Rohan <[EMAIL PROTECTED]> wrote:
>
> > Hello,
> > Can some one tell me how do I get colored text. Say when I want to
> > write something in a text file , how do I get it colored.
>
> Plain text files don't have color. You could output in html ...

Oh ok what about a csv file, I know its also a text file but I want
the color to be say blue in an excel sheet.

-- 
http://mail.python.org/mailman/listinfo/python-list

Help me!!

2007-08-16 Thread Rohan
I have the following piece of code

a = len(ab_file)
   b= 0
   while(bhttp://mail.python.org/mailman/listinfo/python-list


Executing js/ajax in a sandboxed environment

2011-02-26 Thread Rohan Malhotra
I need to parse a url for it's content in python. I want to execute
all js of html page associated with the url and then parse for the
content so that javascript induced changes in content are also
present. I was wondering if there is a way to execute js associated in
page in sandbox environment before I start parsing it.

BeautifulSoup library only fetches source of page. I need the access
to DOM after js execution with url as input parameter.

Any pointers?

-- 
Regards
Rohan
-- 
http://mail.python.org/mailman/listinfo/python-list


CommandLine Option in Python for filtering values from Column

2014-04-09 Thread rohan bareja
I want to write a function in Python for a tab delimited file I am dealing 
with,to filter out values from a column, and put that parameter as a command 
line option while running the script.

So,if the limit is 10,the filter out all the rows with values less than 10.
Also,I want to check if the number entered is numeric or not else display the 
message "its not numeric".


So,the command line would be:

    python script.py file --quality [limit]

    
  The Python script:

    import sys
    arg = []
        for a in sys.argv:
    arg.append(a) 
            quality = arg[2]


To be more specific,the file I am dealing with is a Samfile,and using package 
Pysam,which has mapping quality limits in the 5th column.

https://media.readthedocs.org/pdf/pysam/latest/pysam.pdf

Commandline:

      python script.py samfile --quality [limit]

 I am reading the samfile using this:

     samfile = pysam.Samfile(arg[1], "rb" )
     mapqlim = arg[2]

I am a Python beginner,but saw one of the modules,argparse. How can I 
accomplish this using argparse in Python?-- 
https://mail.python.org/mailman/listinfo/python-list


"run" Package Query

2009-03-03 Thread Rohan Hole
When I write program (.py) with IDLE , I am able to use run package .


- - - -   start  - - - -

if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

- - - -  end - - - - -

above code works simply with the IDLE.

But problem arises , when I use Eric or pyScriptter , On other editor it
gives the error "Exceptions.ImportError : No Module named run"
Do i need to set any variable ? or path ?
run is a system package or third party ?
Thanx In Advance
--
http://mail.python.org/mailman/listinfo/python-list


How to create Standalone PYC File

2009-03-04 Thread Rohan Hole
I have .py file which uses some third party modules like egg files, like
simplejson and python-twitter ,

- start of file  -

import ConfigParser
import getopt
import os
import sys
import twitter


when i compile this py file using compile module , i get .pyc file . Now my
question is , if i run .pyc file on another computer containing only python
installed , will it run ? or do i need to install 3rd party lib again on
that computer ? Anyone know how to make program lib independent , something
called embedded into one file only ?

thank you in anticipation .

Rohan.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How can I find the remainder when dividing 2 integers

2011-01-12 Thread Rohan Pai
Try using dividend % divisor, this will return the remainder

 

Rohan Pai

 

-- 
http://mail.python.org/mailman/listinfo/python-list