Re: [Tutor] Console output

2005-10-05 Thread python-tutor
>>> import sys >>> import time >>> myList=range(10) >>> for x in myList: ... sys.stdout.write(str(x) + "\r") ... sys.stdout.flush() ... time.sleep(1) The "\r" causes a return without a newline feed. Flush forces the text to be output (instead of getting buffered) Enjoy! Todd Maynard

Re: [Tutor] Auto package install?

2005-12-06 Thread python-tutor
Maynard On Tuesday 06 December 2005 12:16, Nelson, Scott wrote: > The Zen of Python (http://www.python.org/doc/Humor.html#zen) states: > > "There should be one-- and preferably only one --obvious way to do it." > > > > I'm searching for the obvious Pytho

[Tutor] regular expressions

2005-12-07 Thread ps python
hi, I am a new python learner. i am trying to parse a file using regular expressions. LOCUS NM_005417 4145 bpmRNA linear PRI 04-DEC-2005 DEFINITION Homo sapiens v-src sarcoma (Schmidt-Ruppin A-2) viral oncogene homolog (avian) (SRC), transcript

Re: [Tutor] regular expressions

2005-12-07 Thread ps python
sorry for repost. awaiting to hear from some members. a scientist suggested me to try biopython. This point is not just with genbank sequences. what will i do if i have to parse a paragraph for some expression. thanks again. hi, I am a new python learner. i am trying to parse a file using

[Tutor] how to extract text by specifying an element using ElementTree

2005-12-08 Thread ps python
Hi, using ElementTree, how can I extract text of a particular element, or a child node. For example: Signal transduction __ Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.sha

[Tutor] how to extract text by specifying an element using ElementTree

2005-12-08 Thread ps python
Hi, using ElementTree, how can I extract text of a particular element, or a child node. For example: Signal transduction Energy process I looked at some tutorials (eg. Ogbuji). Those examples described to extract all text of nodes and child nodes. In

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-08 Thread ps python
x27;) iter = root.getiterator() Here the whole XML document is loaded as element tree and how should this iter into a format where I can apply findall() method. thanks mdan --- Kent Johnson <[EMAIL PROTECTED]> wrote: > ps python wrote: > > Hi, > > > > using Ele

[Tutor] writing list elements into a string

2005-12-15 Thread ps python
hi, can any one pls. help me on this simple issue. I keep forgetting some simple things and they turn out to be very important later. i have a list 'a', and now i want to write all the elements back in to a string. 'apple is a good fruit' - getting this back into a string has drained my brain.

[Tutor] writing list elements into a string

2005-12-15 Thread ps python
-Repost. considering that my previous email lost - hi, can any one pls. help me on this simple issue. I keep forgetting some simple things and they turn out to be very important later. i have a list 'a', and now i want to write all the elements back in to a string. 'apple is a good fruit'

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread ps python
it us unparsable. Would you please help me /guide me what the problem is. Apologies if i am completely ignoring somethings. PS: Attached is the XML file that I am using. --- Kent Johnson <[EMAIL PROTECTED]> wrote: > ps python wrote: > > Kent and Dany, > > Thanks for y

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread ps python
olute path on element") SyntaxError: cannot use absolute path on element >>> for m in tree.findall('functions'): print m.find('molecular_class').text >>> for m in tree.findall('functions'): print m.find('molecular_c

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread ps python
Dear drs. Yoo and johnson, Thank you very much for your help. I successully parsed my GO annotation from all 16,000 files. thanks again for your kind help --- Danny Yoo <[EMAIL PROTECTED]> wrote: > > > >>> for m in mydata.findall('//functions'): > > print m.get('molecular_class').text >

Re: [Tutor] assert

2005-12-23 Thread python-tutor
Try this: >>>a=myClass() >>>b=myClass() >>>a.howmany() >>>a.count=0 >>>del a Does this help clear things up? Todd Maynard On Friday 23 December 2005 06:18, shivayogi kumbar wrote: > class myClass: >                         count = 0 >                          def __init__(self): >            

Re: [Tutor] assert

2005-12-23 Thread python-tutor
Shivayogi, Sorry my last e-mail wasn't very helpful. Better would have been: >>> a=myClass() >>> b=myClass() >>> a.howmany() >>> myClass.count=0 >>> del a which will (hopefully) give you something like: Exception exceptions.AssertionError: in > ignored Assert is commonly used as a sanity

Re: [Tutor] getting text within an element [attribute text] using elementtree

2006-01-19 Thread ps python
Dear group, In my XML file some attributes have text within an element. I want to get that text. How can I do that. I looked into ElementTree -bits and pieces: and there is a small function. >>> def gettext(elem): ... text = elem.text or "" ... for e in elem: ... text += get

Re: [Tutor] understanding __import__()

2006-07-25 Thread python-tutor
Sean Perry wrote: > Ok, this may be slightly above tutor's level, but hey, never hurts to > ask (-: __import__ is dark magic; generally those who venture into that realm would do well to read the C source for Python.. I'm guessing that '.' is not in your sys.path, s

[Tutor] Help Please

2007-01-28 Thread Python Freak
Hi, This may be too elementary for most of you, but could you please help me with the following question? I would like to use comprehensive lists and lists of lists. Where do I start? Question: Consider a digraph with 10 vertices, labeled 1 through 10. You are given the following adjacency list

[Tutor] Help Please

2007-01-28 Thread Python Freak
Hi, This may be too elementary for most of you, but could you please help me with the following question? I would like to use comprehensive lists and lists of lists. Where do I start? Question: Consider a digraph with 10 vertices, labeled 1 through 10. You are given the following adjacency list

Re: [Tutor] What lib should I use?

2008-05-25 Thread python nutter
ng or wanting to make a web spider. Check out a) urllib b) urllib2 c) beautifulsoup a + b are built-ins. c you have to download and install from http://www.crummy.com/software/BeautifulSoup/ Cheers, Python Nutter ___ Tutor maillist - Tutor@python.

Re: [Tutor] wanting to learn

2008-06-11 Thread Python Nutter
ave always wanted to learn a language like > php, asp, .net but I never took the time to learn them. I have recently > found Python and believe this is the language that I will "hang-my-hat-on" > and learn. I was web designer a while back, moved into security, then found pytho

Re: [Tutor] (no subject)

2008-07-29 Thread S Python
Hi Morgan, Have you installed Python on your computer? If you are using Microsoft Windows, you can download and install Python from here: http://python.org/download/releases/2.5.2/ and select "python-2.5.2.msi". Once it's installed, you should have a directory on your ma

[Tutor] Reading List from File

2008-07-31 Thread S Python
Hi Everyone, I am trying to read a comma-delimitted list ("aaa","bbb","ccc") from a text file and assign those values to a list, x, such that: x = ["aaa", "bbb", "ccc"] The code that I have come up with looks like this: >>> x = [] >>> f = open(r'c:\test.txt', 'r') >>> x.extend(f.readlines()) >>

Re: [Tutor] Reading List from File

2008-07-31 Thread S Python
Hi Everyone, Thanks for the variety of responses in such a short amount of time. This distribution list is incredible. Sorry for the delayed reply as I wanted to test what everyone suggested, so here goes: --- @Amin: I tried your suggestion, but perhaps I don't unde

Re: [Tutor] Reading List from File

2008-07-31 Thread S Python
On Thu, Jul 31, 2008 at 2:20 PM, Monika Jisswel <[EMAIL PROTECTED]> wrote: > oops it is reader not Reader (all lower case), so this line : data = > csv.Reader(myfile, delimeter = ',') > should be data = csv.reader(myfile, delimeter = ',') > > > 2008/7

Re: [Tutor] Reading List from File

2008-07-31 Thread S Python
t; > -- Forwarded message -- > From: Emile van Sebille <[EMAIL PROTECTED]> > To: tutor@python.org > Date: Thu, 31 Jul 2008 11:34:56 -0700 > Subject: Re: [Tutor] Reading List from File > S Python wrote: >>>>> >>>>> f = open(r'C:\

[Tutor] Confused about "import Numeric" vs "import numpy" for Arrays

2008-08-08 Thread S Python
Hi Everyone, I would like to create a two-dimensional array but am confused as to how to go about it. I've read about Numeric Python and Numpy. Are they one and the same? Also, how do I install them? I am working on a Windows machine. I've been getting the following erro

Re: [Tutor] Confused about "import Numeric" vs "import numpy" for Arrays

2008-08-08 Thread S Python
> No, they are not the same. Numeric is older; NumArray is another older > package. You should use Numpy if you can. > http://numpy.scipy.org/#older_array > > > Now you should be able to import numpy. > > Kent > Thanks, Kent. I ended up using: >>> from numpy import * I wasn't sure what the diff

Re: [Tutor] Confused about "import Numeric" vs "import numpy" for Arrays

2008-08-08 Thread S Python
> In general "from import *" is a very bad idea. > > import imports a module into its own namespace (e.g., to > access its functionality you would have to do ".foo() and > .bar()" The form that you chose to use imports all of a > module's contents into the current namespace. This means you can ca

Re: [Tutor] Confused about "import Numeric" vs "import numpy" forArrays

2008-08-08 Thread S Python
> A useful tip is that if you have a long module name you can also use > > import module as shortname > > eg > > import numpy as n > > and then access numpy.foo() as > > n.foo() > > Sacves a lot of typing for a slight loss of clarity in > maintenance - you have to remember which module the > short

Re: [Tutor] Confused about "import Numeric" vs "import numpy" for Arrays

2008-08-08 Thread S Python
> Another reason not to use "from xx import *" is that it can make it > very difficult to discover where a name is defined. If you have > several "from xx import *" lines and then later you use a function > "foo()" there is no easy way to tell which module foo came from. > > An alternative is to li

[Tutor] Sorting Dictionary of Dictionary by certain Value

2008-09-23 Thread Joe Python
Hi Pythonistas, I have a large dictionary of dictionary (50,000+ keys) which has a structure as follows: DoD = { 'flintstones' : { 'husband' : "fred", 'pal' : "barney", 'income': 500, }, 'jetsons' : { 'husband' : "george", 'wif

Re: [Tutor] Question

2008-11-10 Thread Python Nutter
I use Notepad++ on my Windows box for Python, but my feeling about it is a bit "Blah..." but thats my feeling with Windows in general ;-) I think I'm one of the rare ones who do not like its choice of Syntax Highlighting colours. But too lazy to change them since I don't do mu

Re: [Tutor] Psyco module

2008-12-08 Thread Python Nutter
It only runs on Intel 386-compatible processors. Once we know what CPU you are using then we can figure it out better. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] PDF Scrapping

2015-11-24 Thread Python Beginner
that pdftables 0.0.4 is an excellent way to scrape tabular data from PDF'S (see https://blog.scraperwiki.com/2013/07/pdftables-a-python-library-for-getting-tables-out-of-pdf-files/ ). I downloaded pdftables 0.0.4 (see https://pypi.python.org/pypi/pdftables). I am new to Python and havi

Re: [Tutor] PDF Scrapping

2015-11-25 Thread Python Beginner
Oh, I forgot to mention that I am using Python 3.4. Thanks again for your help pointing me in the right direction. ~Chris On Tue, Nov 24, 2015 at 1:36 PM, Python Beginner < pythonbeginner...@gmail.com> wrote: > Hi, > > I am looking for the best way to scrape the following PDF&#x

[Tutor] Nested, line by line, file reading

2007-12-16 Thread jon vs. python
Hi everyone, I have a file with this content: "1 1 1 1 1 1 1 2 1 1" I wanted a little script that would print the line containing "2" and every line containing "1" after it. I've tried this: >>> def p(): f = file("prueba.txt",'r') for startline in f.read(): if startline.find("2")

Re: [Tutor] Excited about python

2011-06-10 Thread jon vs. python
Dive into Python: http://diveintopython.org/ is what you're looking for. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] ssh socks proxy

2012-05-16 Thread kushal . kumaran+python
Adam Gold wrote: >I'm trying to write a 'simple' script that will set up a socks proxy >over ssh and maintain the connection until manually terminated. It's >not possible to use key-based authentication so a password will need to >be supplied. Also, note, the user is presented with a list of s

Re: [Tutor] ssh socks proxy

2012-05-16 Thread kushal . kumaran+python
kushal.kumaran+pyt...@gmail.com wrote: >Adam Gold wrote: > >>I'm trying to write a 'simple' script that will set up a socks proxy >>over ssh and maintain the connection until manually terminated. It's >>not possible to use key-based authentication so a password will need >to >>be supplied. Als

<    1   2   3