| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Comments:
<0> is it possible to get keys by value from a dictionary? <1> damg, yep, but don't expect to get exactly one key <1> you could get zero, one or many <0> Greatred, no, that's not a problem. that's actually the effect I want to achieve :) <1> and it'll have to search every key/value pair in the dictionary <0> i thought of using values(), then take the biggest value (those are longs) and that's why I'm asking get a list of keys for this value <1> something like: [key for (key,value) in haystack.iteritems() if value == needle] <1> does that sound right? <0> Greatred, it should work. Thank you <1> enjoy <2> hi <2> what is an easy way to build a string from a list of ints? <3> hi <4> hi channel! I jsut want to use gettext.. i tried the following code.. But its output wasnt as expected.. http://deadbeefbabe.org/paste/484 plz help me <3> using libxml2 how can i get a string from an xml doc? <4> I wanted it to first print "Beenden" and then "Exit"
<4> But it doesnt do the translation.. wat could be the reason? <4> plz point out my mistake <5> moldy: "".join(map(str,listofints)) <2> thx sysfault <4> hey guys.. someone help me.. <4> plz <6> tuxplorer: do you actually have an en.mo to go with that? <4> LarstiQ: where should i check? I'm new to python and gettext.. <6> tuxplorer: the strings won't translate themselves, you have to do that <6> tuxplorer: have a look at the gettext documentation, you need to make a .po for your application and compile that to .mo form (for every language) <4> LarstiQ: how? i just though the translation libraries are already there :) <4> oh! k. <4> s/though/thought/ <6> tuxplorer: that would be impossible, words have different meanings in different context <4> LarstiQ: can you give me the appropriate link to start with? <6> tuxplorer: http://www.gnu.org/software/gettext/manual/html_mono/gettext.html chapters 1 & 2 are good to understand the problemspace <4> LarstiQ: Thanks :) <7> how could unicode string be used where plain strings are expected (for example when using shelve) <7> is there any commonly used conversion between unicode and... for example ascii representation of unicode string? <8> UTF-8 is the common representation. encode the unicode string in utf-8. <8> (And decode it back when you want unicode again.) <9> He could also use the repr form isn't it ? <2> btw, what is the difference between repr() and str()? <10> why i got DeprecationWarning when i try to resizing an image with pil. of course i must use float. and this is what pil doesnt like. can i turn off this warning message? <8> they do different things. str() turns the object into a string (in whichever way the object wants to be turned into a string), where as repr() returns the representation of an object, in a string. repr() is for debugging purposes more than for anything else. <8> avan: depends on the exact deprecation warning. Python's -W option or the 'warnings' module can be used to turn off warnings. However, DeprecationWarnings warn for code that will *start breaking* in a future version, so you're really better off fixing whatever triggers the warning. <2> ah, ok <10> but i cant fix it <10> it must be float <8> avan: can't fix what? what is the warning message? which function are you calling? <10> pil's image resize <10> u know i must use float cos i need accurate vars to resize an image <6> that is only part of the answer <10> DeprecationWarning: integer argument expected, got float <8> avan: so what are you calling? a function? a method? which one? what arguments are you p***ing? <10> a function <10> image.resize(neww,newh,Image.ANTIALIAS) <8> and which argument 'needs to be a float'? <10> w,h <8> the height is in pixels. p***ing a pixel float is senseless, it'll just be turned into an int. <8> and same for width. <11> what ? no subpixel accuracy ? :) <10> ok i know now what is the problem <8> yes... you're p***ing a float. :) <10> its integer but float <10> if i know well :) <10> sorry for the lame question <10> thanks anyway <10> its working now properly <12> Jerub: Ever poked at NOAA's METAR data/format <13> hi all <14> Can I "cd" with Python? <5> os.chdir() <6> Jimmey__: os.chdir <14> Thanks <15> when I have a dictionary: dict[str(fst_line)]=str(list) where fst_line is the key and list is a list of informations. How can I get access to the different list items over the key? <14> And how can I list the contents of the current directory, without having to specify the directory's name as a parameter in os.listdir()? <14> What I mean to say is, how can I output the current working directory? <16> Jimmey__, os.getcwd() <14> Benji, thankyou
<16> np <17> Jimmey__, you might want to look at dir(os) and help(os) <14> Yango, I was in the process. Thanks :) <17> adac, d = { 'key_line': '1,2,3,4' } d['key_line'] will refer to '1,2,3,4' <17> adac, I didn't get what you mean, though <18> hello all <15> Yango: yes, but i want to access only one of those numbers 1,2,3,4 <17> adac, store the list as a list, not as a str'ed list <17> d['the_list'] = [1,2,3,4] <19> adac: or do '1,2,3,4'.split(',')[index] <17> d['the_list'][0] = 1 <6> tp76: considering he has a list to begin with, that's a bit wasteful <19> adac: though, you might want to store the value as a list (or tuple) rather than a string, as Yango said, if this is what you want. <19> LarstiQ: str (list) is a list? <6> tp76: fair enough, the naming could be misleading <19> adac: so, dict[str(fst_line)]=list. Unless there's a reason you need to store strings. <20> hi there <20> anybody here uses pykde (esp. KGlobalAccel) and has a minute or twoe? <21> hi <21> i've got two big CSV files that i would like to paste line to line in one file, do you think it's possible to do that with a python script ? <21> is there a module to parse CSV files ? <19> Comete: sure. See the csv module. <21> tp76: ouah : thanks <21> :) <20> ok, so I have got this code - and after I hit the Accel Key (F11 in this example), I have the app frozen, AND the keyboard not responding (killing the app helps the keyboard): http://rafb.net/paste/results/yTKtci68.html | I am using Linux 2.6.x/Python 2.4. any ideas? <22> I got this very odd phenomenon where my cx_Oracle would segfault together with how sqlalchemy uses it, but only ever with more then 10 threads, below or equal to 10 threads it is rock solid... <23> hello <23> Given a cl*** A: and a cl*** B(A):, how would I convert an instance of A to an instance of B? My first guess would be a function which receives a as an argument, and returns b. Is there a simpler way? <24> Not really, no. <23> TFK: thanks <25> Is there a way to find out where to install extension libraries (automatically, so it can be done from a Makefile)? <26> first of all, you'd have to know what type the object is <26> then theres no guaruntee that they are similar cl***es <26> larsl: python has a special package for doing installs like that <26> http://docs.python.org/lib/module-distutils.html <27> heya <28> fastest way of getting out "file1.txt" from the following string: content-disposition: form-data; name="pics"; filename="file1.txt"? <28> and of course.. i want to be able to get filenames of different sizes <19> zamba: "file1.txt" ;) <16> zamba: s.split('"')[-2] <28> tp76 :) <29> zamba: and if the filename contains '"' ? <27> heya, I'm looking to write some interactive content for websites using python, do you know where I might look for some examples please? <19> zamba: something like re.search ('filename="(.*txt)"$', string) perhaps. <10> hi <30> is there a tab-seperated outputter for the stdlib logger? <31> you mean something like pprint? <27> heya, I'm looking to write a CGI proxy in python, but i've never done any web programming with python before, do you know where I might some examples or anything? <30> Tantalum: a `logging.Formatter` subcl*** <31> oh.. ok <19> Tinned_Tuna: try http://www.python.org/doc/essays/ppt/sd99east/index.htm and Google. <27> thanks, I've bin googling around, but they mostly seem to be written in PHP and perl, I haven't seen any in python (yet) :( <27> cheers. <30> Tantalum: a logging/csv mashup <30> ;) <20> m'kay, I'll try again, maybe this time I'll get some answers ;) <20> anybody using pykde? I am trying to set-up a global Accel Key with KGlobalAccel, but all I get is a frozen app and a frozen keyboard <20> the code is: http://rafb.net/paste/results/yTKtci68.html <32> Is there an easy way to do an indefinite list comprehension? Like [f(x) while x>0]? <32> I don't want to resort to a manual loop if I can avoid it <32> Ah, nevermind, figured it out. Write a generator to do whatever and then die on whatever condition <16> Kousu, the itertools module already provides a generator like that, look at "repeat" <32> No, I don't mean that. What I want is to collect values until some condition fails <19> Kousu: [f(x) for i in ... if cond] perhaps? <19> er, for x in ... <32> That was my first thought, of course, but it doesn't work because it doesn't stop when it has all the values <10> could someone give me Sw1ft3DV4.5Release-473.exe or crack for build: 485 please? :) <32> True, it has the same result but it might run for 2000 times it doesn't need to <16> Kousu, you need this special construct called a "loop" <32> <32>I don't want to resort to a manual loop if I can avoid it <32> I'm just trying to make it more elegan <32> t
Return to
#python or Go to some related
logs:
gentoo broadcom gigabit dhcpcd
#linux SiS 86C326 video card resolution glx-info |grep rendering or nvidia 5500 SDL_Image.DevPak debian GSSAPIAuthentication could not convert undefined or null to object xmlhttprequest #ubuntu wpasuppliment xine engine error no input plugin
|
|