Below is a program I found at
http://starship.python.net/crew/neale/ (though it does
not seem to be there anymore.) It uses a seperate
file for the URLs
--- Adisegna <[EMAIL PROTECTED]> wrote:
> My question is how to use a loop to go through a
> tuple of URLs. Please feel
> free to suggest an ea
Hi all.
In my application I have chosen as data structure a list of
dictionaries. Each dictionary has just one key and the corresponding
value.
structure = [{'field1': lenght1}, {'field2': lenght2}, ]
Initially, to obtain the key and the value I used this code,
for structure in record_st
János Juhász said unto the world upon 2005-11-21 01:20:
> Hi,
>
> I can't imagine how this could be made with list comprehension.
>
>
import operator
a = (([1],[2],[3,31,32],[4]), ([5],[6],[7, 71, 72]), ([8],[9]))
reduce(operator.add, a) # it makes a long list now
>
> ([1], [2], [3,
Negroup - said unto the world upon 2005-11-21 03:26:
> Hi all.
> In my application I have chosen as data structure a list of
> dictionaries. Each dictionary has just one key and the corresponding
> value.
>
> structure = [{'field1': lenght1}, {'field2': lenght2}, ]
>
> Initially, to obtai
Hi,
mydic = {'one': 1, 'two': 2} # to access key: for x in mydic.keys(): print x # to access value --> use key print mydic['one']
Cheers,
pujo
On 11/21/05, Negroup - <[EMAIL PROTECTED]> wrote:
Hi all.In my application I have chosen as data structure a list ofd
>>> a = (([1],[2],[3,31,32],[4]), ([5],[6],[7, 71, 72]), ([8],[9]))
>>> reduce(operator.add, a) # it makes a long list now
([1], [2], [3, 31, 32], [4], [5], [6], [7, 71, 72], [8], [9])
When I make list comprehension, the list hierarchy is allways the same or
>>> [item for item in a] # the deepnes
> Each dictionary has just one key and the corresponding
> value.
>
> structure = [{'field1': lenght1}, {'field2': lenght2}, ]
I'd use a tuple rather than a dictionary here:
structure = [('field1', lenght1), ('field2', lenght2), ]
> but after some thoughts I arrived to:
> field_n
2005/11/21, Brian van den Broek <[EMAIL PROTECTED]>:
> Hi Negroup,
>
> why not just make structure a dict:
>
> structure = {'field1': lenght1, 'field2': lenght2}
>
> What does having a list of dicts all with a single key add but a layer
> of referencing when you want to access?
>
> If you are tryi
2005/11/21, Alan Gauld <[EMAIL PROTECTED]>:
> > Each dictionary has just one key and the corresponding
> > value.
> >
> > structure = [{'field1': lenght1}, {'field2': lenght2}, ]
>
> I'd use a tuple rather than a dictionary here:
Of course, this makes a lot of sense.
[cut]
> you can now
János Juhász wrote:
> Hi,
>
> I can't imagine how this could be made with list comprehension.
>
import operator
a = (([1],[2],[3,31,32],[4]), ([5],[6],[7, 71, 72]), ([8],[9]))
reduce(operator.add, a) # it makes a long list now
>
> Is it possible to substitute reduce with comprehensio
hello,
I found that if I use Numeric.array into unittest it is not consistance, Is that normal ?
import unittestimport Numeric
class myTest(unittest.TestCase): def runTest(self): var1 = Numeric.array([1,22]) var2 = Numeric.array([1,33]) self.assertEqual(var1,var2)
if __
Hello tutors!
My file search dialog is working now! I attach a copy of the module. It
would be nice, if someone could look over it and make suggestions to improve
it. There are at least two points I find not very elegant in the program:
1. The dialog is ended by raising a SystemExit exception. (I
Hallo.
I want to parse a website for links of this type:
http://www.example.com/good.php?test=anything&egal=total&nochmal=nummer&so=site&seite=22";>
-
re_site = re.compile(r'http://\w+.\w+.\w+./good.php?.+";>')
for a in file:
lmac wrote:
> Hallo.
> I want to parse a website for links of this type:
>
> http://www.example.com/good.php?test=anything&egal=total&nochmal=nummer&so=site&seite=22";>
>
> -
> re_site = re.compile(r'http://\w+.\w+.\w+./good.php?
Ok. There is an error i made. The links in the HTML-Site are starting
with good.php so there was no way ever to find an link.
re_site = re.compile(r"good\.php.+'")
for a in file:
z = re_site.search(a)
if z != None:
print z.group(0)
This will give me every line sta
lmac wrote:
> Ok. There is an error i made. The links in the HTML-Site are starting
> with good.php so there was no way ever to find an link.
>
> re_site = re.compile(r"good\.php.+'")
> for a in file:
> z = re_site.search(a)
> if z != None:
> print z.group(0)
>
>
> This
At 08:52 PM 11/20/2005, ->Terry<- wrote:
-BEGIN PGP SIGNED
MESSAGE-
Hash: SHA1
Ok, I've got my peg game roughed out and I'm having
problems.
The error is:
Traceback (most recent call last):
File "pypeg.py", line 113, in ?
main()
File "pypeg.py", line 107, in main
x.draw_b
> Probably due to the lacking of experience, but each time I code a
> datastructure I am never satisfied, and I have the feeling that I'm
> not on the right way..
The same thing happens to me. I actually have a very similar problem to
yours now, and I'm rather considering a list of two-element t
Hi all,
I am not sure if this is a Python problem not not but here goes
I wrote the following small script to email by boss 'email_addr' a rather
important reminder and also send a copy to myself 'email_addr2' several times
a day.
#!/usr/bin/env python
# -*- coding: iso8859_1 -*-
fr
On Mon, 2005-11-21 at 19:59 +, dave wrote:
> Traceback (most recent call last):
> File "/home/dave/my files/andrew_torture/email_remind.py", line 49, in ?
> email_remind()
> File "/home/dave/my files/andrew_torture/email_remind.py", line 43, in
> email_remind
> raise 'Mail Failure
Hi Karsten,
You might want to look at Python MegaWidgets: http://pmw.sourceforge.net/
PMW is an alternative to Tix, built using only python and basic
Tkinter. It has a scrolled listbox widget and a way of easily
creating modal dialogs.
--
John.
___
Tu
On 21/11/05, János Juhász <[EMAIL PROTECTED]> wrote:
> I can't imagine how this could be made with list comprehension.
>
> >>> import operator
> >>> a = (([1],[2],[3,31,32],[4]), ([5],[6],[7, 71, 72]), ([8],[9]))
> >>> reduce(operator.add, a) # it makes a long list now
> ([1], [2], [3, 31, 32], [4]
On Mon, 21 Nov 2005, enas khalil wrote:
> i want to confirm with you that the right addresses to send to are :
> python-list@python.org
> tutor@python.org
> arent they ?
[Keeping Tutor in CC; if I'm out of line, I want to make sure someone
calls me on it and keeps me grounded.]
Hi Ena
On Mon, 21 Nov 2005, enas khalil wrote:
> thanks again ,sir
> i finally understand what you mean
> sorry for annoying you several times ,promise not to do this again
>
> execuse me can i ask you aquestion about how can i use codecs in read
> and tag an arabic text file
> thanks again
Hi all,
I have looked for any references of ellipsis '...' syntax for Python
slices, but I keep finding the same BNF grammar in the
LanguageRreference. Is there any page with examples on how to do this,
or is this just very obscure?
I remember reading something about this syntax somewhere, lon
On 22/11/05, Hugo González Monteverde <[EMAIL PROTECTED]> wrote:
> I have looked for any references of ellipsis '...' syntax for Python
> slices, but I keep finding the same BNF grammar in the
> LanguageRreference. Is there any page with examples on how to do this,
> or is this just very obscure?
Hugo González Monteverde wrote:
> Hi all,
>
> I have looked for any references of ellipsis '...' syntax for Python
> slices, but I keep finding the same BNF grammar in the
> LanguageRreference. Is there any page with examples on how to do this,
> or is this just very obscure?
ellipsis is used
Ok, now I know I don't need them just now *grin* Next time I will
remember to search the newsgroup
Now I think it was the perlish skeletons in my closet coming back to me.
Thanks a lot for that,
Hugo
___
Tutor maillist - Tutor@python.org
http:/
I need to add the count statement to give urllib access the tuple of
urls. urllib needs to be given a different value each time in order to
check all the urls. This is the only way I could get the value (web) in
urllib to change each time. I tried indenting the count statement and
it runs without e
This worked for me. Thanks!
--
for web in urls:
for site in urllib.urlopen(web):
---
You
have to indent the statement 'count += 1' so it is part of the loop.
But you misunderstand the for loop
I'm trying to write a tree data structure as part of my first
object oriented program
I have an error "can't assign to function call" caused by this line:
Tree.nodeList(self.name) = self
however, nodeList is a dictionary I'm trying to index.
Beyond the error I'm still not sure I understand how t
At 08:38 PM 11/21/2005, Vincent Wan wrote:
>I'm trying to write a tree data structure as part of my first
>object oriented program
>
>I have an error "can't assign to function call" caused by this line:
>Tree.nodeList(self.name) = self
Tree.nodeList[self.name] = self
>however, nodeList is a dicti
Thank you bob. I fixed the errors where I tried to index a dictionary
with name()
so so that they say name[]
>> Beyond the error I'm still not sure I understand how to make and
>> use a tree data structure using objects.
There is a new error as well
Traceback (most recent call last):
File "
I have a code here. I understand i can not draw lines without the
global definition of lastX and lastY. But still confused by its use.
when should we use global definition?
from Tkinter import *
root = Tk()
c = Canvas(root, bg='#0e2e0e', height=500, width=1000)
frame = c
lastX=""
lastY=""
def cl
Hi John,
thanks it.
It is great. I looked for it, but I couldn't made it.
I have tried it with wrong order:
# I have tried it so
[x for x in y for y in a]
[[8], [8], [8], [9], [9], [9]] # that is wrong,
# Instead of that you wrote
[x for y in a for x in y]
[[1], [2], [3, 31, 32], [4], [5], [6],
35 matches
Mail list logo