| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Comments:
<0> moral of the story is, don't be quick to ***ume why people are doing what they're doing <1> I wasn't ***uming anything, except that when he said shuffle and queue in the same sentence, he was referring to the mode of usage that shuffle usually implies: queue-like. <2> halley, on demand?0 <0> you ***umed he was shuffling before he said that... <1> mcmillen, I suggested he shuffle. I didn't ***ume he was shuffling. <1> I first answered how to do it by extraction, as he was asking. Read up. <3> thanks halenger, mcmillen <3> thanks halley * <1> No prob. <0> welcome <4> Is there any way to figure out what end-of-line character is used by the operating system a script is running on? <4> (ie \r\n for windows, \r for mac, and \n for *nix) <5> os.linesep <4> thank you <6> akcom: Why do you care though? <4> replacing end lines with <br>
<4> (parsing source code) <7> br for BRRRRRRRRRRROOOOM <6> akcom: if you openn the file in the default text mode, the newline is \n. <8> are there any image libraries that can do antialiased 2d line/arc/etc drawing? <5> j4cbo: cairo <4> Erwin: I'm reading the entire thing into a string <4> not parsing it line by line <8> Jerub: ah, i'd thought that was display-output only <0> i have a short pycairo script to plot a set of antialiased points <0> to a PNG i believe <8> that would be a big win <1> akcom, I don't know about python, but in perl, when you read a line, it automatically turns the os line endings into \n for you. <8> mcmillen: actually, the docs have a good example as well <9> http://deadbeefbabe.org/paste/2976 <4> halley, I'm not reading the file line by line <9> so IndexErrors crop up in the (leaky) code in the middle of the try...except IndexError block <0> ok, well, galaxymage.org/tmp/cairo.py if you want my simple example <9> and the program just aborts without running my exception handler <10> pydiction <9> hm <9> wait, it works <9> lol <9> of course it works <9> python always works <9> Scratch: fine then <0> the point of swearing is that people are "prejudiced" against it. <9> mcmillen: lol good point <11> lollipop <9> lollercoaster? <12> rainbows, jellydrops? <6> akcom: Regardless, if you have opened the file in text mode, newlines are translated. <13> is " ".join(["%s" % x for x in range(5)]) the 'right' way to collapse a list of numbers into a string? <14> I'm developing a IRC bot...but I need a bit of help. I'm writing a function where if someone says ( for exampple ). '-nick hellobot'. And it would change it's name to 'hellobot'...right now I have something like this: <14> Wait a sec... <13> waiting <14> :P <14> Well...I fixed the nick function a different way. <14> Say I wanted to do something like '-whois Jinx' <14> It would see the whois and do the command...but needs to somehow read the nick (in this case Jinx) <14> Someone said something like <13> split it <14> clientsock.recv(1024).split()[1] <14> Or something <13> yep <14> That doesn't work. <14> :| <14> Here...let me show you <14> I gotta read something first... <15> damnit, why do they have to have multiple talks at the same time for pycon? <14> okay.. <14> so <14> I have this <14> elif "-query" in line: <14> query = clientsock.recv.split()[1] <14> clientsock.send("WHOIS eff.org %s" % query)) <14> That should work...right? <14> oops..with out the extra parenthasee at the end <13> besides the syntax error
<13> heh <14> But...that would work? <14> Yea <13> .recv(1024).split()[1] <13> not .recv.split, i dont think <14> Yea <14> Sorry <14> Just fixed it <0> woah, wait. you already got the line with clientdock.recv(), right? so i think you want query = line.split()[1] <14> Oh..right <0> otherwise you are reading more data <14> mcmillen: Shouldn't it be <14> query = clientsock.recv(1024) <14> query.split()[1] <14> ? <0> ummm.. what is the variable "line"? <16> is there a way to do "a='sys';import a" ? <14> line... <16> import a module named by a variable <17> In pyparsing, I'm trying to do a code block within square brackets <17> I'm trying logic = Word("[")+anything+Word("]") <14> let me paste it on pastebin <0> is the line like "-query somedata"? <17> whree anything is a regex to accept .* <17> Is there a nice way of doing recursive expressions? At the moment my regex is matching against the first space after the word and tgus it's effectively useless <17> (not working) <0> ne78: consider __import__ (but if there's another way of doing what you want to do, the other way os probably better) <14> mcmillan: http://pastebin.com/567905 <14> mcmillan: Not all the code is working <14> I'm just working on it :\ <16> mcmillen ok i will use exec file in scope, instead <16> mcmillen i think it will do the job <0> cratuki: i don't know anything about pyparsing, but in general you cannot handle recursion with regular expressions. <17> OK, thanks <18> test <0> so i think the parser itself has to keep track of that somehow (number of parens opened so far, or whatever) <14> mcmillan: So should it be query.split()[1] <14> Or <14> or query = line.split()[1] <0> i think you want: if "-query" in line: query = line.split() <0> or split[1], or whatever <14> lemme try that <0> or split()[1], i mean <14> Is his better? <14> elif "-query" in line: <14> clientsock.recv(1024) <14> query = line.split() <14> clientsock.send("WHOIS eff.org %s" % query) <0> don't do the clientsock.recv() <14> ohhh... <0> you don't want to receive more data at that point, the needed data is already in "line" <14> okay..thanks <14> Lemme try that. <0> and also, you want clientsock.send(.... % query[1]) <6> cratuki: Look at the definition of e.g dblQuotedString in pyparsing.py <6> cratuki: But it depends on whether you want to nest or just want to skip until the next ] <19> I actually like Perl's Text::Balanced module. <19> Makes many things easy. <20> mmm <2> how possible is prototype based OO in Python <20> and Parse::RecDescent for those not so easy things <19> kbrooks: Not really. Python is not prototype based OO language. <19> kbrooks: Io looks good, by the way. <21> kbrooks: You mean type hinting? <2> _42: no <17> Erwin: Thanks <20> kbrooks: not trivial, but you could sort of pull it off with metacl***es <17> Erwin: looking <19> _42: prototype, as opposed to cl***. <2> see javascript <21> Ah, as in Js <21> Yeah
Return to
#python or Go to some related
logs:
perl error near my #css substring_replace mysql vanscot gentoo mouse pointer theme ubuntu zlib-dev gentoo glibc_2.4 not found #oe libstdc++ scalix mysql composite index date time
|
|