Re: how to get select label?
[EMAIL PROTECTED] wrote: > I built a select in a form. My select is: > print '' > print 'ALL' > print 'AAA' > print 'BBB' > print '' > > I can get which item value users select. For example users select item > 2, I can get its value "001". But now I want to get item label "AAA", > not its value "001". How I can do this. I use python to code. This is actually a HTML question, not python: You're doing it almost right except that the option tag should be closed as always. ALL AAA BBB better yet but may not be supported in all browsers (try): -- http://mail.python.org/mailman/listinfo/python-list
Re: Issues with "twistd" in Twisted 16.4.0
On 01/09/16 20:17, Kevin Conway wrote: Hi, you might not get much of an answer for this on the Python mailing list. I suggest sending your question to the Twisted mailing list instead: https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python. On Thu, Sep 1, 2016 at 7:12 AM juraseg wrote: Also, I've tried to find anything in Twisted bug tracker, but I can't find my way in there. -- https://mail.python.org/mailman/listinfo/python-list Thanks! I'll try there -- https://mail.python.org/mailman/listinfo/python-list
pdb with emacs
Hi, I am trying to learn python and use the gud/pdb from emacs. The functionality that I am used to under gud/gdb and gud/perldb is missing, or I don't know how to make it work. Specifically: when I start pdb on a script file, the source does not show in an another window as it does with perldb and gdb. If I bring it up in an another window, the ^X SPC set a break, but the subsequent gud-next commands do not move the execution cursor in the source file window. Any help will be greatly appreciated. -- http://mail.python.org/mailman/listinfo/python-list
Embedding Python - Freeing Python Objects Not Using Py_DECREF
Hello, I'm embedding Python interpreter in a Win32 console application. I use C++. I would like to use the WinAPI LoadLibrary function to load the python dll at runtime (followed by GetProcAddress calls), so that I have to make no assumptions about the location of the dll. However I can't use the macro Py_DECREF if I load the dll this way. Is there a way to properly free python objects (specifically - dictionaries created by PyDict_New() and the object returned by PyRun_String()) not using Py_DECREF? Alternatively, is there a way to include the python header - to make the macro Py_DECREF available, but to be able to locate the python dll whenever python is installed? (The problem is that python may be installed anywhere, and the python dll does not always appear in system folders - sometimes it is in the python installation directory, thus it is unclear which targets to specify to the linker to search for the dll). I'd appreciate any help. Thanks in advance, -- http://mail.python.org/mailman/listinfo/python-list
Trouble trying to install Python 3.5.1 (32-bit) for windows
Dear Python, I encountered difficulties when installing the python. Could you guys help me to solve and install it?! Attached log error to help you guys to help me out. =) ;) Regards, [cid:image001.png@01D18EA7.4A69B7E0] [cid:image006.jpg@01D152DC.ACCAF540] Yuri Armellei Tesouraria Tel.: +55 11 3034-5004 - Cel.: (11) 9.9916-8323 www.casadocredito.com.br<http://www.casadocredito.com.br> Av. Queiroz Filho, 1700 - Torre E - 9º. andar - conj. 907 Vila Hamburguesa - São Paulo - SP - Brasil - 05319-000 Este e-mail e qualquer documento anexo ao mesmo é destinado somente às pessoas elencadas acima, podendo conter informações confidenciais e ou legalmente privilegiadas. Se você não for um dos destinatários do presente e-mail e seus anexos, por meio do presente toma ciência que sua disseminação, distribuição ou cópia é estritamente proibida. Se tiver recebido este e-mail e seus anexos por engano, agradeço comunicação imediata através do telefone (11) 3034-5004 e exclusão permanente do original e de qualquer cópia ou impressão que tenha sido realizada. This e-mail and any attachments thereto, are intended only for use by the addresses named herein and may contain legally privileged and or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify me at +55(11) 3034-5004 and permanently delete the original and any copy of any e-mail and any printout thereof. -- https://mail.python.org/mailman/listinfo/python-list
Help with regex needed
Good day everyone, I am trying to make this pretty simple regex to work but got stuck, I'd appreciate your help . Task: Get current date , then read file of format below, find the line that matches the current date of month,month and year and extract the number from such line. Here is what I did , but if i run it at 11 April 2011 ... - regex pattern_match matches nothing - regex pattern_test matches the line "4141411 Fri 11 11 2011" , logical as it is the last matching line in year 2011 with the date of 11th. My question - why regex pattern_match does not match anything and how to make it match the exact line i want. Thanks Yuri from datetime import datetime, date, time import re today_day = datetime.now() time_tuple= today_day.timetuple() pattern_match = re.compile("([0-9])+ +" + "Fri +" + str(time_tuple[1]) + " +" + str(time_tuple[2]) + " +" + str(time_tuple[0]) + " +") hhh = open("file_with_data.data",'r') pattern_test = re.compile("([0-9]+)" + ".*" + " +" + str(time_tuple[2]).strip(' \t\n\r') + " +" + str(time_tuple[0]).strip(' \t\n\r') ) for nnn in hhh: if (re.search(pattern_test,nnn)): print nnn.split()[0] 111 Fri 4 8 2011 2323232 Fri 4 15 2011 4343434 Fri 4 22 2011 8522298 Fri 4 29 2011 . 5456678 Fri 10 28 2011 563 Fri 11 4 2011 4141411 Fri 11 11 2011 332 Fri 11 18 2011 -- -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with regex needed
Thanks everybody , and especially Chris - i used split and it took me 15 mins to make it work :) The final version looks like: from datetime import datetime, date, time today_day = datetime.now() time_tuple= today_day.timetuple() hhh = open("file_with_data.data",'r') for nnn in hhh: if nnn.split()[2] == str(time_tuple[1]).strip(' \t\n\r') and nnn.split()[4] == str(time_tuple[0]).strip(' \t\n\r') and nnn.split()[3] == str(time_tuple[2]).strip(' \t\n\r') : print nnn Cheers and good day everyone Yuri On Tue, Apr 12, 2011 at 8:58 AM, Chris Rebert wrote: > On Mon, Apr 11, 2011 at 10:20 PM, Yuri Slobodyanyuk > wrote: > > Good day everyone, > > I am trying to make this pretty simple regex to work but got stuck, > > I'd appreciate your help . > > "Some people, when confronted with a problem, think 'I know, I'll use > regular expressions.' Now they have two problems." > > > > 111 Fri 4 8 2011 > > 2323232 Fri 4 15 2011 > > 4343434 Fri 4 22 2011 > > 8522298 Fri 4 29 2011 > > . > > 5456678 Fri 10 28 2011 > > 563 Fri 11 4 2011 > > 4141411 Fri 11 11 2011 > > 332 Fri 11 18 2011 > > There's no need to use regexes to parse such a simple file format. > Just use str.split() [without any arguments] on each line of the file, > and do the field equality checks yourself; your code will simpler. > Relevant docs: http://docs.python.org/library/stdtypes.html#str.split > > Cheers, > Chris > -- > http://blog.rebertia.com > -- Taking challenges one by one. http://yurisk.info http://ccie-security-blog.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with regex needed
Thanks for the insight, while this code will run once a week and optimization isn't really a must here, it is still a good idea not to leave half-baked code behind me, especially given that it will be running on this server for the next 13 years ;) I have one doubt though . Doesn't using the list comprehension here increase number of loops per the same string ? for nnn in [x.split() for x in hhh]: My vision here is that after doing the comprehension it would look: for nnn in [1st_field,2nd_field,3rd_filed,...,nth_filed]: ... and therefore would do number of loops equal to number of fields while we really need just one ? Thanks Yuri On Tue, Apr 12, 2011 at 3:50 PM, D'Arcy J.M. Cain wrote: > On Tue, 12 Apr 2011 15:06:25 +0300 > Yuri Slobodyanyuk wrote: > > Thanks everybody , and especially Chris - i used split and it took me 15 > > mins to make it work :) > > That's great. One thing though... > > > for nnn in hhh: > > if nnn.split()[2] == str(time_tuple[1]).strip(' \t\n\r') and > > nnn.split()[4] == str(time_tuple[0]).strip(' \t\n\r') and > nnn.split()[3] > > == str(time_tuple[2]).strip(' \t\n\r') : > > You are running split() on the same string three times and running > strip on the same time tuple each time through the loop. I know that > you shouldn't optimize before testing for bottlenecks but this is just > egrecious as well as making it more difficult to read. Consider this. > > year = str(time_tuple[0]) # strip() not really needed here > mon = str(time_tuple[1]) > day = str(time_tuple[2]) > > for nnn in [x.split() for x in hhh]: >if nnn[2] == mon and nnn[3] = day and nnn[4] = year: > > If strip() were needed you could leave off the argument. The default > is to strip all whitespace from both ends. In fact, read up on locales > to see why it is a good idea to omit the argument. > > -- > D'Arcy J.M. Cain | Democracy is three wolves > http://www.druid.net/darcy/| and a sheep voting on > +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. > -- Taking challenges one by one. http://yurisk.info http://ccie-security-blog.com -- http://mail.python.org/mailman/listinfo/python-list
Re: compiling 3.7.0 from source with custom libffi path
Hi, I dont have "lib64" in libffi, are you sure it is "lib64" or just "lib"? On Monday, 1 July 2019 21:32:46 UTC+9, tom...@gmail.com wrote: > On Monday, September 24, 2018 at 11:48:59 AM UTC+3, Fetchinson . wrote: > > I'm trying to compile python 3.7.0 from source with a custom libffi > > path and the compiler/linker doesn't seem to pick up the right > > version. The system libffi doesn't have the development files so I've > > installed the latest libffi (also from source) to /opt/custom but > > still I get > > > > INFO: Could not locate ffi libs and/or headers > > > > Failed to build these modules: > > _ctypes > > > > Although I compile python with --prefix=/opt/custom because that's the > > location I'd like to install it too. So how do I tell the build system > > where to find my custom libffi? > > > > Cheers, > > Daniel > > > > > > > > -- > > Psss, psss, put it down! - http://www.cafepress.com/putitdown > > After some messing around with the build scripts, I figured it out. This > works for me: > > 0. Choose installation path for FFI -> $LIBFFI_PATH > 1. Configure, build, install libffi: > 1a. Download libffi from https://sourceware.org/libffi/ and untar it > 1b. ./configure --prefix $LIBFFI_PATH > 1c. make > 1d. make install > 2. Configure CPython: (I'm using tcsh syntax, it is slightly different with > bash) > 2a. setenv PKG_CONFIG_PATH $LIBFFI_PATH/lib/pkgconfig/ > 2b. setenv LDFLAGS "-L $LIBFFI_PATH/lib64/" > 2c. /configure --with-pydebug > 3. Build > 3a. setenv LD_LIBRARY_PATH "${LIBFFI_PATH}/lib64/" > 3b. make -s -j2 > > Good luck! -- https://mail.python.org/mailman/listinfo/python-list