@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19



Comments:

<0> ok guys, this one is really dumb: I need to add an element to the a list i would like to place it like l[3] = 'A' however this copies over the existing element. What is the proper way to add to an existing list?
<1> axis 2 ?
<1> l.append()
<2> parks: ya, apache's axis 2
<1> gaiadog01 list.insert(position, value)
<0> parks: doesnt l.append() add this to the end of the list.
<0> ah, i see thanks!!!!
<2> anyone work with python's ZSI SOAP service? (Or some other implementation I don't know of) I wonder if its good enough to convince my employer to switch...
<3> http://deadbeefbabe.org/paste/116
<3> There is something in that code that is locking up my interpreter.
<3> It's not even an infinite loop, since I can ctrl+c out of that.
<4> Drakonik: umm you are having it generate the entire structure over and over again in that while True loop
<3> Hm.
<3> Why am I not suprised that I could be so stupid?
<4> you don't want to do list(getAllCombos())
<3> Oh?



<4> just do for combo in getAllCombos():
<4> when you do list it generates all of them
<4> if you just iterate over it you will get one at a time
<3> Ah.
<4> the system will use less memory and run faster
<4> there is no need for a while True as a result also
<3> I see that now. Thanks.
<0> Hello again, I am using raw_input to gather zipcodes from the user. I would like to make the zipcode the key and the letter 'A' the value in a dictionary for each zipcode entered. How might I do this?
<5> d[zipcode] = "A"
<2> and if you want a number, instead of the default string from raw_input, use: int(zipcode)
<0> thanks guys!
<2> actually, that brings up a question: does dictitonary work better with integers or strings as keys? (Or no real difference?)
<5> zipcodes can start with zero, though
<5> integers hash to themselves
<5> so i think you should use the integer as the key, and just remember to pad it with zeros when printing
<2> jleedev: actually, zip codes can have that sub-code part, seperated by a "-", right? in this case, using integers is out.
<5> good point. it depends on the situation, though.
<0> Oh gosh, this is really what I need to do. I use raw_input to gather a zipcodes sepertated by commas, after they press enter I need to add each zipcode as a key in a dict with the value 'A'.
<6> gaiadog01: so just do that
<4> why the value of A?
<0> i know, im a bit thick and not sure how to parse the string of zipcodes (10977,10952,10911) and then add the to a dict.
<4> also why use a dict?
<4> it seems that set would be a much better idea
<5> a set would be better
<0> Well 'A' is going to be used as a sort code depending on the zipcode
<6> gaiadog01: dict([(x.strip(),'A') for x in inputstring.split(",")])
<5> set(re.split("[^\d]+",inputstring))
<6> (and yes, I did mix '' and "" in that line, which isn't particularly good form)
<7> hello
<7> what is a kitchen sink?
<5> ANYTHING AND EVERYTHING
<7> o
<5> kapace: what's the context?
<7> does it have something to do with monty python
<7> ?
<6> not that I'm aware of
<7> k
<6> I don't even know if it's particularly British
<7> o
<0> Leeds: wow thanks
<6> gaiadog01: it's easy when you know how :-)
<8> kapace: it's an expression to do with camping actually.
<8> kapace: someone who brings along a backpack that contains nearly everything necessery, and everything unnecessery is said to have brought along, "everything except the kitchen sink"
<9> is tkinter still part of the standard windows python distribution?
<9> hello...
<5> i think idle's written in tkinter
<9> i can't seem to import it
<9> ah frick, case-sensitive
<9> nevermind
<5> ooh yeah, that's annoying
<5> Tkinter
<0> Leeds: If I use the list comprehnsion that you showed be earlier how can I now use the same technique with the new keys (zipcodes) and value of 'B'
<0> I guess how do I append key?
<6> you can use update to add one dict to another, overwriting values where appropriate
<9> I want to use Tkinter's color database (but not the functions)...
<10> is there any way to get the python stack for a running process that is hung (consuming 100% cpu)?
<9> I can't get it to recognize the color names
<11> teratorn: Attach with gdb
<10> exarkun: yeah I could get the C stack
<10> exarkun: any way to get the python one w/ that?
<11> teratorn: PyObject_CallAttr(PyEval_ImportModule("traceback"), "print_stack") or something



<10> scary
<12> teratorn: compile python with gdb
<12> teratorn: err, with debugging. then attach gdb to python
<12> teratorn: and use a bunch of macros that let you walk the python stack -- there's a sample gdbinit file included in the python distro
<13> how do I get maxint?
<11> sys.maxint
<0> Leeds: Thanks again :)
<12> teratorn: see e.g. http://www.python.org/~jeremy/weblog/031003.html
<10> exarkun, Erwin: yeah, good ideas.
<10> unfortunately, I'm afraid this might not be easily reproduceable
<12> teratorn: and http://wingware.com/doc/howtos/debugging-extension-modules-on-linux
<12> teratorn: well, if you are really lucky: us gcore to make a core file
<12> recompile python with -g and hope every sym will be exactly the same
<11> teratorn: you may be able to run the line I gave when you attach with gdb
<12> then run gdb on new debugging python on the core you created
<12> hmm, that's an interesting idea. Though it's destructive
<11> most likely, yes.
<10> ok, let me dump a core first
<10> ehh, can gdb even do this
<12> you won't be able to run the PyObject_ stuff on the core, obviosly. Unless maybe you use something like xemacs' de-coreifer :)
<12> do what? It can do anything
<12> Oh well, time to go out and enjoy my stay in (relatively) sunny california
<10> i don't know how to dump a core file with gdb
<12> gcore
<10> ah, generate-core-file
<10> ok done. now to segfault it.
<10> Erwin: ah sorry, i missed your line about gcore before
<10> exarkun: hmm, seems PyObject_CallAttr is there, but many other PyObject_Call* things are.
<10> err, *isn't*
<14> hi all
<14> I have a file in gmail export format (Name,E-mail,Notes)
<14> is it easy to convert it in mutt format (aliases) using python?
<14> format is --> alias aliasname real-name email-address
<5> import csv
<14> jleedev: ????
<5> csv is comma separated vaules
<5> it will parse the gmail output for you
<5> and presumably let you read it a line at a time
<14> wowwowww!!!! how do I start
<6> payal: no you're not
<14> Leeds: ok
<5> >>> c = csv.reader(file("gmail.csv"))
<5> >>> c.next()
<5> ['Name', 'E-mail', 'Notes', 'Section 1 - Description', 'Section 1 - Email', 'Section 1 - IM', 'Section 1 - Phone', 'Section 1 - Mobile', 'Section 1 - Pager', 'Section 1 - Fax', 'Section 1 - Company', 'Section 1 - Title', 'Section 1 - Other', 'Section 1 - Address', 'Section 2 - Description', 'Section 2 - Email', 'Section 2 - IM', 'Section 2 - Phone', 'Section 2 - Mobile', 'Section 2 - Pager', 'Section 2 - Fax', 'Section 2 - Company', 'Section
<5> Title', 'Section 2 - Other', 'Section 2 - Address']
<5> >>> c.next()
<5> ['First Last', 'user@gmail.com', '']
<8> jleedev: try not to spam next time.
<5> sorry
<8> payal: for row in csv.reader(file('myfile.fromgmail')): print row
<14> Jerub: yes getting them in a list now
<10> crap how do you p*** NULL in a gdb "call" command
<8> teratorn: NULL == 0
<10> hmm, doesn't gdb redirect stdout/err to the terminal gdb is using?
<14> brb, power failure
<10> hah, holy **** it worked.
<10> just had to 'continue' to give stdout/err time to flush, and now i have a stack dump in my twisted log
<10> call PyObject_CallObject(PyObject_GetAttrString(PyImport_ImportModule("traceback"), "print_stack"), 0)
<15> is there a python module available for the AOL OSCAR protocol?
<16> endeavormac: twisted supports it to some degree, i believe
<11> Alas, not anymore, as far as I can tell. :(
<11> About a month ago the protocol change in an incompatible way.
<16> doh
<11> Yea, really ****s.
<11> Hopefully someone will update it, but right now it's not clear who or when.
<16> i am thinking of rewriting the IRC-client kinda thing sjj and I did with twisted
<11> TOC support may still work, which lets you get onto the same network, but with fewer features.
<16> how's the IRC support these days?
<11> Same as always, pretty much: ugly but usable :)
<17> that was only a month ago?
<16> is it the old API, or did your irc2 or something else supercede it?


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #python
or
Go to some related logs:

jerrybme
#linux
nvtv mplayer xinit
gentoo accept.keywords
dhclient3 sniffer
kubuntu famd
3gpwiz gentoo
noegnud ubuntu
#osdev
totem_plparser



Home  |  disclaimer  |  contact  |  submit quotes