Re: Printing Unicode strings in a list

2022-04-30 Thread Vlastimil Brom
čt 28. 4. 2022 v 13:33 odesílatel Stephen Tucker napsal: > > Hi PythonList Members, > > Consider the following log from a run of IDLE: > > == > > Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] > on win32 > Type "copyright", "credits" or "license()" for m

Re: Confusing textwrap parameters, and request for RE help

2020-03-25 Thread Vlastimil Brom
22. 3. 2020 v 20:02 Chris Angelico : > > When using textwrap.fill() or friends, setting break_long_words=False > without also setting break_on_hyphens=False has the very strange > behaviour that a long hyphenated word will still be wrapped. I > discovered this as a very surprising result when tryin

Re: How to create a RGB color Table

2019-06-17 Thread Vlastimil Brom
po 17. 6. 2019 v 11:30 odesílatel Jorge Conrado Conforte napsal: > > HI, > > Please someone could help me. How can I create a new color table with the > values of r g and b that I have. I use the Mataplolib color tables. However, > I would like to use a new color table with the respective r g b

Re: polar coordinates?

2018-12-09 Thread Vlastimil Brom
2018-12-09 17:30 GMT+01:00, Brian Christiansen : > I have been messing with a program that is inspried by a video on > youtube that is about the vizualization of pi. I might make a post > about that program someday, but I want to talk about something else. > One of the ways of visualizing it is to

Re: Number 7 syntax ERROR

2018-11-08 Thread Vlastimil Brom
2018-11-08 2:52 GMT+01:00, NoHaxAllSwagg : > Hello, > I have been experiencing difficulty while trying to run scripts on my IDLE > software, considering that when I run my program, I get an error at the top > of the page in the “Python 3.7.1” area, highlighting the seven telling me > that there is

Re: Format list of list sub elements keeping structure.

2018-07-24 Thread Vlastimil Brom
2018-07-24 3:52 GMT+02:00, Sayth Renshaw : > I have data which is a list of lists of all the full paths in a json > document. > > How can I change the format to be usable when selecting elements? > > data = [['glossary'], > ['glossary', 'title'], > ['glossary', 'GlossDiv'], > ['glossary', 'Gloss

Re: List slicing on Python 2.7

2018-03-15 Thread Vlastimil Brom
2018-03-15 12:54 GMT+01:00 Arkadiusz Bulski : > I have a custom class (a lazy list-like container) that needs to support > slicing. The __getitem__ checks if index is of slice type, and does a list > comprehension over individual integer indexes. The code works fine on > Python 3 but fails on 2.7,

Re: RegExp - please help me!

2017-12-26 Thread Vlastimil Brom
Hi, I can't comment, whether this is the right approach, as I have no experiences with C++, but for the matching regular expression itself, I believe, e.g. the following might work for your sample data (I am not sure, however, what other details or variants should be taken into account): (?s)struc

Re: matplot plot hangs

2017-11-01 Thread Vlastimil Brom
2017-11-01 13:49 GMT+01:00 Andrew Z : > Wolfgang, > I tried to ran from ide with no rwsults, so now im trying from a terminal > in xwindow. > The .plot is the last line in the script and it does hang trying to execute > it. > > > On Nov 1, 2017 05:44, "Wolfgang Maier" < > wolfgang.ma...@biologie.u

Re: Regular expression query

2017-03-12 Thread Vlastimil Brom
2017-03-12 17:22 GMT+01:00 : > Hi All, > > I have a string which looks like > > a,b,c "4873898374", d, ee "3343,23,23,5,,5,45", f > "5546,3434,345,34,34,5,34,543,7" > > It is comma saperated string, but some of the fields have a double quoted > string as part of it (and t

Re: Does one create an event to notify parent window/GUI of something?

2017-03-12 Thread Vlastimil Brom
2017-03-12 13:14 GMT+01:00 Chris Green : ... > > This question relates to how one communicates between windows/GUIs. > > When the program starts theres a main GUI, class name abookgui. If > you want to add new entries or modify existing entries an edit GUI is > started in a separate window, class

Re: an other issue when installing python under Windows OS

2016-10-12 Thread Vlastimil Brom
2016-10-12 14:24 GMT+02:00 Karlheinz Hoening : >Hello all, > >on my iMac I have installed Windows (7) and I am now trying to install >Python 3.5.2 (32-bit) under Windows OS. >Every time after having 'repaired' with the installation procedere I >receive the following message when

Re: generator no iter - how do I call it from another function

2016-10-01 Thread Vlastimil Brom
2016-10-01 12:09 GMT+02:00 Sayth Renshaw : > My main issue is that usually its just x in ,,, for a generator. > > But if I change the code > for meet in roots.iter("meeting"): > > to > for meet in roots("meeting"): > > Well its invalid but I need to be able to reference the node, how do I > achiev

Re: pyinstaller

2016-07-27 Thread Vlastimil Brom
2016-07-27 3:15 GMT+02:00 Larry Martell : > On Tue, Jul 26, 2016 at 8:49 PM, Tom Brown wrote: >> I used pyinstaller quite a bit 3 years ago. I could brush off the cobwebs >> and see if I can help if you have not solved it already. >> >> What is the issue you are having? > > If I import the request

Re: math.frexp

2016-07-16 Thread Vlastimil Brom
2016-07-15 13:39 GMT+02:00 Steven D'Aprano : > I'm experimenting with various implementations of product(values). Here's a > naive version that easily suffers from overflow: > > from functools import reduce > from operator import mul > > def product_naive(values): > return reduce(mul, values) >

Re: python regex: variable length of positive lookbehind assertion

2016-06-15 Thread Vlastimil Brom
2016-06-15 5:28 GMT+02:00 Yubin Ruan : > Hi everyone, > I am struggling writing a right regex that match what I want: > > Problem Description: > > Given a string like this: > > >>>string = "false_head aaa bbb false_tail \ > true_head some_text_here ccc ddd eee > true_tail" > > I w

Re: Detecting repeated subsequences of identical items

2016-04-20 Thread Vlastimil Brom
2016-04-21 5:07 GMT+02:00 Steven D'Aprano : > I want to group repeated items in a sequence. For example, I can group > repeated sequences of a single item at a time using groupby: > > > from itertools import groupby > for key, group in groupby("BBCDDEEE"): > group = list(group) > pr

Re: What's the best/neatest way to get Unicode data from a database into a grid cell?

2016-02-08 Thread Vlastimil Brom
2016-02-08 11:42 GMT+01:00 : > Vlastimil Brom wrote: >> >> Hi, >> your code in >> http://www.salstat.com/news/linking-wxgrid-to-sqlite-database-in-python-an-example >> >> seems to work for me after small changes with both python 2.7 and 3.4 >> (using

Re: What's the best/neatest way to get Unicode data from a database into a grid cell?

2016-02-07 Thread Vlastimil Brom
2016-02-07 12:19 GMT+01:00 : > I'm using this as a starting point for creating a grid to view and > edit some sqlite data:- > > http://www.salstat.com/news/linking-wxgrid-to-sqlite-database-in-python-an-example > > I can actually understand most of it which is a good start. > > However my dat

Re: import locale and print range on same line

2016-01-23 Thread Vlastimil Brom
2016-01-23 11:36 GMT+01:00 Marko Rauhamaa : > rai...@gmail.com: > >> Can someone tell me why next code doesn't work? >> >> import locale; locale.setlocale(locale.LC_ALL, ""); for i in >> range(1,20,4): print(locale.format("%2f", i, 1)) >> >> It gives an error: SyntaxError: invalid syntax --> indica

Re: one more question on regex

2016-01-23 Thread Vlastimil Brom
2016-01-22 23:47 GMT+01:00 mg : > Il Fri, 22 Jan 2016 21:10:44 +0100, Vlastimil Brom ha scritto: > >> [...] > > You explanation of re.findall() results is correct. My point is that the > documentation states: > > re.findall(pattern, string, flags=0) > Return

Re: one more question on regex

2016-01-22 Thread Vlastimil Brom
2016-01-22 16:50 GMT+01:00 mg : > Il Fri, 22 Jan 2016 15:32:57 +, mg ha scritto: > >> python 3.4.3 >> >> import re re.search('(ab){2}','abzzabab') >> <_sre.SRE_Match object; span=(4, 8), match='abab'> >> > re.findall('(ab){2}','abzzabab') >> ['ab'] >> >> Why for search() the match is 'abab'

Re: Trailing zeros of 100!

2016-01-02 Thread Vlastimil Brom
2016-01-02 18:34 GMT+01:00 yehudak . : [partly edited for bottom posting] > On Sat, Jan 2, 2016 at 5:24 PM, Vlastimil Brom > wrote: >> >> 2016-01-02 14:14 GMT+01:00 yehudak . : >> > [...]>> > On Sat, Jan 2, 2016 at 2:44 PM, Vlastimil Brom >> > >&

Re: Trailing zeros of 100!

2016-01-02 Thread Vlastimil Brom
2016-01-02 14:14 GMT+01:00 yehudak . : > Vlastimil, > Thank you so much, but... > All that is Chinese for me. > Can you show a 'normal' Python code for me? > > Yehuda > > On Sat, Jan 2, 2016 at 2:44 PM, Vlastimil Brom > wrote: >> >> 2016-01-02

Re: Trailing zeros of 100!

2016-01-02 Thread Vlastimil Brom
2016-01-02 12:49 GMT+01:00 : > Hi, newbie here! > I'm trying to write a python program to find how many trailing zeros are in > 100! (factorial of 100). > I used factorial from the math module, but my efforts to continue failed. > Please help. > > Thank you, > Yehuda > -- > https://mail.python.o

Re: Catogorising strings into random versus non-random

2015-12-21 Thread Vlastimil Brom
2015-12-21 4:01 GMT+01:00 Steven D'Aprano : > I have a large number of strings (originally file names) which tend to fall > into two groups. Some are human-meaningful, but not necessarily dictionary > words e.g.: > > > baby lions at play > saturday_morning12 > Fukushima > ImpossibleFork > > > (note

Re: textfile: copy between 2 keywords

2015-09-10 Thread Vlastimil Brom
2015-09-10 13:18 GMT+02:00 Gerald : > Hey, > > is there a easy way to copy the content between 2 unique keywords in a .txt > file? > > example.txt > > 1, 2, 3, 4 > #keyword1 > 3, 4, 5, 6 > 2, 3, 4, 5 > #keyword2 > 4, 5, 6 ,7 > > > Thank you very much Hi, just to add another possible approach, you

conditional sys.excepthook (outside of the interactive interpreter)?

2015-03-09 Thread Vlastimil Brom
Hi all, I'd like to as for advise about posibilities of redirecting error traceback via sys.excepthook in a gui (wxpython in my case) with a requirement, that the errors from the code typed in the interactive interpreter (as part of my app) are printed there directly and are not catched from the ex

Re: Tkinter frame reset

2014-08-09 Thread Vlastimil Brom
2014-08-09 2:38 GMT+02:00 Nicholas Cannon : > Ok so I am working on a little project and I cant seem to solve something > with it. I have a label and then a clear button and I want all the numbers in > the label to clear when I push the button. This button is on a separate frame > to the buttons

Re: What is the simplest method to get a vector result?

2014-07-24 Thread Vlastimil Brom
2014-07-24 14:53 GMT+02:00 fl : > Hi, > I have read a lot about Python, but it still has a problem now on a simple > exercise. For example, I want to generate a sine curve. First, I get a time > sequence: > > index=range(100) > > I import math module, try to calculate sine with > > math.sin(index*m

Re: Python's re module and genealogy problem

2014-06-11 Thread Vlastimil Brom
2014-06-11 14:23 GMT+02:00 BrJohan : > For some genealogical purposes I consider using Python's re module. >... > > Now, my problem: Is there a way to decide whether any two - or more - of > those regular expressions will match the same string? > > Or, stated a little differently: > > Can it, for a

Re: Regular Expression for the special character "|" pipe

2014-05-27 Thread Vlastimil Brom
2014-05-27 12:59 GMT+02:00 Aman Kashyap : > I would like to create a regular expression in which i can match the "|" > special character too. > > e.g. > > start=|ID=ter54rt543d|SID=ter54rt543d|end=| > > I want to only |ID=ter54rt543d| from the above string but i am unable to > write the pattern

Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]

2014-05-01 Thread Vlastimil Brom
2014-05-01 3:57 GMT+02:00 Chris Angelico : > On Thu, May 1, 2014 at 9:46 AM, Ian Kelly wrote: >> It also works if your starting point is (precisely) the north pole. I >> believe that's the canonical answer to the riddle, since there are no >> bears in Antarctica. > > Yeah but that's way too obvio

Re: Significant digits in a float?

2014-04-29 Thread Vlastimil Brom
2014-04-28 18:00 GMT+02:00 Roy Smith : > I'm using Python 2.7 > > I have a bunch of floating point values. For example, here's a few (printed > as reprs): > > 38.0 > 41.2586 > 40.752801 > 49.25 > 33.7951994 > 36.8371996 > 34.1489 > 45.5 > > Fundamentally, these numbers hav

Re: How to properly get the microseconds from the timestamps?

2014-04-22 Thread Vlastimil Brom
2014-04-22 4:38 GMT+02:00 Igor Korot : ... datetime.datetime.fromtimestamp(1092787200/1000.0) > datetime.datetime(1970, 1, 13, 7, 33, 7, 20) > > Is there a way to know if the timestamp has a microseconds? > > Thank you. > -- Hi, I believe, in these cases, you can just test, whether there i

Re: calling Python script from another Python script (Windows, multiple installation problem)

2014-03-26 Thread Vlastimil Brom
2014-03-26 10:40 GMT+01:00 Martin Landa : > Hi all, > > I am trying to fix a bug in the project which I am working for. The program > starts on Windows via bat file which calls a Python script to set up the > environment including GUI and allow to launch program-specific tools. Some of > the too

Re: Get a datetime with nanoseconds

2014-02-11 Thread Vlastimil Brom
2014-02-11 6:42 GMT+01:00 Igor Korot : > Hi, ALL, > I am woking on an application for digital forensic. > In this application I am getting this 2 pieces of information: > > atime - long representing the time stamp > atime_nano - long representing the nanoseconds. > > What I'd like to do is to have

Re: On a scrollbar for tkinter

2014-01-03 Thread Vlastimil Brom
2014/1/3 : > @Rick > I found some solutions for python 2.x, but still, as I am with the future, I > need a futuristic solution or 2, so if anyone else could help me, I'd be > grateful! > -- Hi, I usually don't use tkinter myself, hence others may have more idiomatic suggestions, but you can of

Re: Count each unique element in list of lists

2013-11-08 Thread Vlastimil Brom
2013/11/8 Yaşar Arabacı : > Hi, > > I have a function that returns something like this; > > [[[1, 5, 9], [2, 6, 7], [3, 4, 8]], [[1, 6, 8], [2, 4, 9], [3, 5, 7]]] > > It is a list of list of lists. Each uppermost list is called a result. > I want to write a code that > shows that each elem in subli

Re: extraction tool using CRF++

2013-10-01 Thread Vlastimil Brom
2013/10/1 cerr : > Hi, > > I want to write an extraction tool using CRF++ > (http://crfpp.googlecode.com/svn/trunk/doc/index.html). > I have written a trainings file and a template: > training: > banana FOODB-NP > bread FOODI-NP > template: > U01:%x[0,1] > U02:%x[1,1] > > and now I want

Re: Iterate through a list of tuples for processing

2013-09-20 Thread Vlastimil Brom
2013/9/20 Shyam Parimal Katti : > I have a list of tuples where the number of rows in the list and the number > of columns in tuples of the list will not be constant. i.e. > > ...> i.e. > > list_value = [(‘name1’, 1234, ‘address1’ ), (‘name2’, 5678, ‘address2’), > (‘name3’, 1011, ‘addre”ss3’)] > >

Re: Antispam measures circumventing

2013-09-20 Thread Vlastimil Brom
2013/9/20 Jugurtha Hadjar : > Hello, > # I posted this on the tutor list, but my message wasn't displayed > I shared some assembly code (microcontrollers) and I had a comment wit my > e-mail address for contact purposes. > Supposing my name is John Doe and the e-mail is john@hotmail.com, my > e

Re: Remove \n, " " from tuple.

2013-09-18 Thread Vlastimil Brom
2013/9/18 Venkat Addala > Hi all, > > I have a tuple in this format, which is retrived using MySQLdb, now i want > to remove \n and extra spaces in this. > > 13L, 'ssDsC', 'CEs5s1, DsC', 'srylscetsmight\nghtscetylsse', '3', > '3q25.1', 151531861L, 151546276L, '+', '1 kjafhkfhlad\fdfdsdf ghtscetyl

Re: how does not work nested comment in python?

2013-09-04 Thread Vlastimil Brom
2013/9/4 : > example: > > print "hello" # print comment +"world"=> single line comment > print "hello" '''print comment''' +"world" => multiple line comment > -- > https://mail.python.org/mailman/listinfo/python-list Hi, python only has single line comments, which apply from a "#" to the en

Re: How can I remove the first line of a multi-line string?

2013-09-02 Thread Vlastimil Brom
2013/9/2 Anthony Papillion : > Hello Everyone, > > I have a multi-line string and I need to remove the very first line from > it. How can I do that? I looked at StringIO but I can't seem to figure > out how to properly use it to remove the first line. Basically, I want > to toss the first line but

Re: can't get utf8 / unicode strings from embedded python

2013-08-25 Thread Vlastimil Brom
2013/8/25 David M. Cotter : > i'm sorry this is so confusing, let me try to re-state the problem in as > clear a way as i can. > > I have a C++ program, with very well tested unicode support. All logging is > done in utf8. I have conversion routines that work flawlessly, so i can > assure you

Re: Python variable as a string

2013-08-23 Thread Vlastimil Brom
2013/8/23 Jake Angulo : > Sorry this is a very basic question. > > I have a list var which after some evaluation I need to refer to var as a > string. > > Pseudocode: > > var = ['a', 'b' , 'c' , 'd'] > adict = dict(var='string', anothervar='anotherstring') > anotherdict = dict() > if : > anothe

Re: [GUI] Good frameworks for Windows/Mac?

2013-08-06 Thread Vlastimil Brom
2013/8/6 Gilles : > Hello > > I need to write a small GUI application that should run on Windows and > Mac. > > What open-source framework would you recommend? I just need basic > widgets (button, listbox, etc.) and would rather a solution that can > get me up and running fast. > > I know about wxW

Re: Numeric coercions

2013-07-07 Thread Vlastimil Brom
2013/7/7 Steven D'Aprano : > I sometimes find myself needing to promote[1] arbitrary numbers > (Decimals, Fractions, ints) to floats. E.g. I might say: > > numbers = [float(num) for num in numbers] > > or if you prefer: > > numbers = map(float, numbers) > > The problem with this is that if a string

Re: looking for a linguistical/semiotic quote

2013-06-27 Thread Vlastimil Brom
2013/6/27 rusi : > I am looking for a quote > (from Whorf/Sapir/Wittgenstein/Humboldt dunno... that 'school') > > It goes something like this: > > What characterizes a language is not what we can say in it but what we must > -- like it or not -- say. > [...] Hi, I belive, the author is Roman Jako

Re: Libroffice PMT equivalent in python

2013-04-25 Thread Vlastimil Brom
2013/4/25 ஆமாச்சு > Hi, > > Are there equivalent in any Python libraries that could match function > like PMT in libreoffice? > > Refer: https://help.libreoffice.org/Calc/Financial_Functions_Part_Two#PMT > > -- > > Amachu > -- > http://mail.python.org/mailman/listinfo/python-list > Hi, you may c

Re: A string and an integer to appear in tuple (python 2.7)

2013-03-12 Thread Vlastimil Brom
2013/3/13 Jiewei Huang : > Hi all, > > I'm currently stuck at this question on > > Writing a function len_str that takes a string as an argument and returns a > pair consisting of the length of the string and the string itself. > > Example: len_str('Meaning of life') should return the tuple (15, '

Re: Recursive function

2013-03-05 Thread Vlastimil Brom
2013/3/5 Ana Dionísio : > Hello! > > I have to make a script that calculates temperature, but one of the > parameters is the temperature in the iteration before, for example: > temp = (temp_-1)+1 > > it = 0 > temp = 3 > > it = 1 > temp = 3+1 > > it = 2 > temp = 4+1 > > How can I do this in a simple

Re: simple GUI environment

2013-03-05 Thread Vlastimil Brom
2013/3/5 Eric Johansson : > I need a simple GUI toolkits like easygui pythoncard. The main reason I > discount both of those is that they are effectively dead as I can see. Last > updates in the 2010/2011 range. Has there been some toolkit to replace them? > And no, the existing wxpython/gtk/qt/...

Re: Encoding problem in python

2013-03-04 Thread Vlastimil Brom
2013/3/4 : > I have a problem with encoding in python 27 shell. > > when i write this in the python shell: > > w=u'العربى' > > It gives me the following error: > > Unsupported characters in input > > any help? > -- > http://mail.python.org/mailman/listinfo/python-list Hi, I guess, you are using

Re: Best way to convert number of minutes to hh:mm AM/PM?

2013-03-01 Thread Vlastimil Brom
2013/3/2 : > Hi, > > I need to create a list of equally spaced times (as in hh:mm AM/PM) within a > day to loop through. Having selected 30 minute intervals I figured I could: > > * Create a list from 1 to 48 > * Multiply each value by 30 > * Convert minutes to a time. datetime.timedelta seems to

Re: Correct handling of case in unicode and regexps

2013-02-23 Thread Vlastimil Brom
2013/2/23 Devin Jeanpierre : > Hi folks, > > I'm pretty unsure of myself when it comes to unicode. As I understand > it, you're generally supposed to compare things in a case insensitive > manner by case folding, right? So instead of a.lower() == b.lower() > (the ASCII way), you do a.casefold() ==

Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple?

2013-01-02 Thread Vlastimil Brom
2013/1/2 Victor Hooi : > Hi, > > I'm using pysvn to checkout a specific revision based on date - pysvn will > only accept a date in terms of seconds since the epoch. > > I'm attempting to use time.mktime() to convert a date (e.g. "2012-02-01) to > seconds since epoch. > > According to the docs, m

Re: numpy has got newtonsmethod?

2013-01-01 Thread Vlastimil Brom
2013/1/2 Usama Khan : > thanks. . > > but how to instal scipy. because its in .rar form. .i have extracted the > files to the place where python2.7 is installed. . but everytime i write > import sciPy. .it give me error. . > nd regarding ur question. . > > its a long story telling u why i have ju

Re: numpy has got newtonsmethod?

2013-01-01 Thread Vlastimil Brom
2013/1/2 Usama Khan : > my question is can we import newtonsmethod from nympy or sciPy? > -- > http://mail.python.org/mailman/listinfo/python-list Hi, After successfully installing SciPy http://www.scipy.org/Download you should be able to import the respective modules and use this functionality su

Re: ignore case only for a part of the regex?

2013-01-01 Thread Vlastimil Brom
2013/1/1 Steven D'Aprano : > On Sun, 30 Dec 2012 10:20:19 -0500, Roy Smith wrote: > >> The way I would typically do something like this is build my regexes in >> all lower case and .lower() the text I was matching against them. I'm >> curious what you're doing where you want to enforce case sensit

Re: Considering taking a hammer to the computer...

2012-12-31 Thread Vlastimil Brom
2013/1/1 : > Hey :) > > I'm trying to help my son with an assignment and spending hours making an > inch of progress. I know nothing about programming and I'm trying to learn, > on my own, at a rate faster than possible. I would love a little help! > > My son is taking an introductory course an

Re: Beginner: Trying to get REAL NUMBERS from %d command

2012-12-30 Thread Vlastimil Brom
2012/12/30 Alvaro Lacerda : > The code I wrote is supposed to ask the user to enter a number; > Then tell the user what's going to happen to that number (x / 2 + 5) ; > Then give the user an answer; > > I succeeded getting results from even numbers, but when I try diving an > uneven number (i.e. 5

Re: ignore case only for a part of the regex?

2012-12-30 Thread Vlastimil Brom
2012/12/30 Helmut Jarausch : > Hi, > > is there a means to specify that 'ignore-case' should only apply to a part > of a regex? > > E.g. > > the regex should match Msg-id:, Msg-Id, ... but not msg-id: and so on. > > I've tried the pattern > r'^Msg-(?:(?i)id):' > but (?i) makes the whole pattern

Re: calculation on lists

2012-12-19 Thread Vlastimil Brom
2012/12/19 loïc Lauréote : > hi, > I > have a question, > is there a tool to calculate on list ? > > something like : > >>a= [1,1,1,1] >>b = [5,9,8,4] >>c = a+b*a >>print c >>[6,10,9,5] > > Thx > > -- > http://mail.python.org/mailman/listinfo/python-list > Hi, I guess, if you are interested in ef

Re: calculation on lists

2012-12-19 Thread Vlastimil Brom
2012/12/19 loïc Lauréote : hi, I have a question, is there a tool to calculate on list ? something like : >a= [1,1,1,1] >b = [5,9,8,4] >c = a+b*a >print c >[6,10,9,5] Thx == Hi, for such simpler cases, you may try list comprehensions and probably the zip(...) function >>> [a+b*a for a,b

Re: py2exe is on Sourceforge list of top growth projects

2012-12-18 Thread Vlastimil Brom
2012/12/18 Colin J. Williams : ... > Yes, but py2exe appears limited to Python 2.6. > > PyInstaller is another option with similar functionality. > > Colin W. > -- > http://mail.python.org/mailman/listinfo/python-list There are versions for python 2.3 - 2.7: http://sourceforge.net/projects/py2exe/

Re: How to exactly set style in tkinter.ttk

2012-12-17 Thread Vlastimil Brom
2012/12/17 Netrick : > So, we have now in python 3 the tile module > http://tktable.sourceforge.net/tile/screenshots/unix.html integrated as > tkinter.ttk. However, in the python and tk docs there is a lot about that > tkk, but only how to set your own style for specific widgets. There is > nothing

Re: Unicode

2012-12-17 Thread Vlastimil Brom
2012/12/17 Anatoli Hristov : >> if you only see encoding problems on printing results to your >> terminal, its settings or unicode capability might be the cause, >> however, if you also get badly encoding items in the database, you are >> likely using an inappropriate encoding in some step. > > I g

Re: String manipulation in python..NEED HELP!!!!

2012-12-10 Thread Vlastimil Brom
2012/12/10 : > I need help with a program i am doing. it is a cryptography program. i am > given a regular alphabet and a key. i need to use the user input and use the > regular alphabet and use the corresponding letter in the key and that becomes > the new letter. i have the basic code but nee

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-06 Thread Vlastimil Brom
2012/12/6 Neil Cerutti : > On 2012-12-05, Vlastimil Brom wrote: >> ... PARSNIP, certified organic > > I'm not sure on this one. > >> ('PARSNIP', ', certified organic') > > -- > Neil Cerutti > -- Well, I wasn't either, when I noti

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-06 Thread Vlastimil Brom
2012/12/5 Nick Mellor : > Neil, > > Further down the data, found another edge case: > > "Spring ONION from QLD" > > Following the spec, the whole line should be description (description starts > at first word that is not all caps.) This case breaks the latest groupby. > > N > -- > http://mail.pyth

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Vlastimil Brom
2012/12/4 Nick Mellor : > I love the way you guys can write a line of code that does the same as 20 of > mine :) > I can turn up the heat on your regex by feeding it a null description or > multiple white space (both in the original file.) I'm sure you'd adjust, but > at the cost of a more compl

Re: regex function driving me nuts

2012-10-23 Thread Vlastimil Brom
2012/10/23 MartinD. : > Hi, > > I'm new to Python. > Does someone has an idea what's wrong. I tried everything. The only regex > that is tested is the last one in a whole list of regex in keywords.txt > Thanks! > Martin > > > > def checkKeywords( str, lstKeywords ): > > for regex

Re: get each pair from a string.

2012-10-21 Thread Vlastimil Brom
2012/10/21 Vincent Davis : > I am looking for a good way to get every pair from a string. For example, > input: > x = 'apple' > output > 'ap' > 'pp' > 'pl' > 'le' > > I am not seeing a obvious way to do this without multiple for loops, but > maybe there is not :-) > In the end I am going to what to

Re: why do this program not fullscreen?

2012-09-25 Thread Vlastimil Brom
2012/9/25 Levi Nie : > the code: > import wx > app=wx.App() > win=wx.Frame(None) > win.ShowFullScreen() > app.MainLoop() > > > -- > http://mail.python.org/mailman/listinfo/python-list > Hi, win.ShowFullScreen(True) should work, the boolean parameter appears to be required. hth, vbr -- http://m

Re: [SOLVED] Least-lossy string.encode to us-ascii?

2012-09-14 Thread Vlastimil Brom
2012/9/14 Tim Chase : > On 09/13/12 16:44, Vlastimil Brom wrote: >> >>> import unicodedata >> >>> unicodedata.normalize("NFD", u"serviço móvil").encode("ascii", >> >>> "ignore").decode("ascii") >

Re: Least-lossy string.encode to us-ascii?

2012-09-13 Thread Vlastimil Brom
2012/9/13 Tim Chase : > I've got a bunch of text in Portuguese and to transmit them, need to > have them in us-ascii (7-bit). I'd like to keep as much information > as possible, just stripping accents, cedillas, tildes, etc. So > "serviço móvil" becomes "servico movil". Is there anything stock >

Re: get the matched regular expression position in string.

2012-09-03 Thread Vlastimil Brom
2012/9/3 contro opinion : > Here is a string : > str1="ha,hihi,a,ok" > I want to get the position of "," in the str1,Which can count 3,8,14. > how can I get it in python ? > -- > http://mail.python.org/mailman/listinfo/python-list > Hi, you can use re.finditer to match all "," and the start()

Re: Regex Question

2012-08-18 Thread Vlastimil Brom
2012/8/18 Frank Koshti : > Hey Steven, > > Thank you for the detailed (and well-written) tutorial on this very > issue. I actually learned a few things! Though, I still have > unresolved questions. > > The reason I don't want to use an XML parser is because the tokens are > not always placed in HTM

Re: Intermediate Python user needed help

2012-08-05 Thread Vlastimil Brom
2012/8/5 John Mordecai Dildy : > Current Problem at the moment > > Traceback (most recent call last): > File "ex26.py", line 66, in > beans, jars, crates = secret_formula(start-point) > NameError: name 'start' is not defined > > anyone know how to make start defined > -- > http://mail.python

Re: simpler increment of time values?

2012-07-06 Thread Vlastimil Brom
Thanks to all for further comments! Just for completeness and in case somebody would like to provide some suggestions or corrections; the following trivial class should be able to deal with the initial requirement of adding or subtracting dateless time values (hour:minute). regards, vbr # # # #

Re: simpler increment of time values?

2012-07-05 Thread Vlastimil Brom
Many thanks to all for your suggestions! @ChrisA Yes, the calculations with seconds since the Unix epoch is very convenient for real times, but trying to make it dateless seemed to make it more complicated for me. The expected output for the increments asked by Jason was already correctly stated

simpler increment of time values?

2012-07-04 Thread Vlastimil Brom
git hours formatted without the leading zero? Thanks in advance for any suggestions or remarks; regards, Vlastimil Brom -- http://mail.python.org/mailman/listinfo/python-list

Re: Plot a function with matplotlib?

2012-05-19 Thread Vlastimil Brom
2012/5/19 Steven D'Aprano : > I have matplotlib and iPython, and want to plot a function over an > equally-spaced range of points. > > That is to say, I want to say something like this: > > plot(func, start, end) > > rather than generating the X and Y values by hand, and plotting a scatter > graph.

Re: Invalid syntax error

2012-03-10 Thread Vlastimil Brom
2012/3/10 sl33k : > I'm trying project euler problem 3 and I've hit the wall with this > error. What could be the problem here? > >  l=[] num=600851475143 i=1 while i<=num: > ...     if num%i==0: > ...         l.append(i) > ...     i+=1 > ... print max(l) >  File "", line 5 >    prin

Re: re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ?

2012-02-14 Thread Vlastimil Brom
2012/2/14 Devin Jeanpierre : > Hey Pythonistas, > > Consider the regular expression "$*". Compilation fails with the > exception, "sre_constants.error: nothing to repeat". > > Consider the regular expression "(?=$)*". As far as I know it is > equivalent. It does not fail to compile. > > Why the inc

Re: Regexp : repeated group identification

2011-12-14 Thread Vlastimil Brom
2011/12/14 candide : ... > > Thanks for the reference and the example. I didn't know of this > reimplementation, hoping it offers the Aho-Corasick algorithm allowing > multiple keys search. > -- > http://mail.python.org/mailman/listinfo/python-list Hi, I am not sure about the underlying algorithm

Re: Regexp : repeated group identification

2011-12-14 Thread Vlastimil Brom
2011/12/14 candide : > Consider the following code > > # > import re > > z=re.match('(Spam\d)+', 'Spam4Spam2Spam7Spam8') > print z.group(0) > print z.group(1) > # > > outputting : > > > Spam4Spam2Spam7Spam8 > Spa

Re: Question: Optional Regular Expression Grouping

2011-10-10 Thread Vlastimil Brom
2011/10/10 galyle : > HI, I've looked through this forum, but I haven't been able to find a > resolution to the problem I'm having (maybe I didn't look hard enough > -- I have to believe this has come up before).  The problem is this: > I have a file which has 0, 2, or 3 groups that I'd like to rec

Re: regexp compilation error

2011-09-30 Thread Vlastimil Brom
2011/9/30 Ovidiu Deac : > This is only part of a regex taken from an old perl application which > we are trying to understand/port to our new Python implementation. > > The original regex was considerably more complex and it didn't compile > in python so I removed all the parts I could in order to

Re: Generating equally-spaced floats with least rounding error

2011-09-24 Thread Vlastimil Brom
2011/9/24 Chris Angelico : > On Sat, Sep 24, 2011 at 11:53 PM, Steven D'Aprano > wrote: >> #1 add multiples of the width to the starting value, 0. >> >> #2 subtract multiples of width from the ending value, 2.1. > > #3, go half and half - generate the lower half by adding to the lower > bound, and

Re: how to make a nested list

2011-09-15 Thread Vlastimil Brom
2011/9/15 Stef Mientki : > hello, > > I need a nested list, like this > A= [ [None,None], [None,None], [None, None] ] A[2][0] =77 A > [[None, None], [None, None], [77, None]] > ... > > thanks, > Stef > -- > http://mail.python.org/mailman/listinfo/python-list > Besides the above suge

Re: How do I automate the removal of all non-ascii characters from my code?

2011-09-13 Thread Vlastimil Brom
n file Convert to Creole.py > on line 1, but no encoding declared; see > http://www.python.org/peps/pep-0263.html for details >>>> Exit Code: 1 > > Line 1: a=u'''≤'''.encode("ascii", "ignore").decode("ascii") > >

Re: How do I automate the removal of all non-ascii characters from my code?

2011-09-13 Thread Vlastimil Brom
2011/9/13 ron : > > Depending on the load, you can do something like: > > "".join([x for x in string if ord(x) < 128]) > > It's worked great for me in cleaning input on webapps where there's a > lot of copy/paste from varied sources. > -- > http://mail.python.org/mailman/listinfo/python-list > Well

Re: How do I automate the removal of all non-ascii characters from my code?

2011-09-12 Thread Vlastimil Brom
2011/9/12 Alec Taylor : > Good evening, > > I have converted ODT to HTML using LibreOffice Writer, because I want > to convert from HTML to Creole using python-creole. Unfortunately I > get this error: "File "Convert to Creole.py", line 17 > SyntaxError: Non-ASCII character '\xe2' in file Convert t

Re: what's the command for (cd ..) in python

2011-09-09 Thread Vlastimil Brom
2011/9/9 kaustubh joshi : > Hello friends, > How do we carry out the command "cd .." in python? > > My problem is : > I have a set of folders say m=1,2,3,4. In each of these folders, I have > subfolders with common name say m_5,m_6,m_7,m_8. In each of these subfolder, > the

Re: Portable locale usage

2011-09-06 Thread Vlastimil Brom
2011/9/6 ssegvic : > Hi, > > I am musing on how to write portable Python3 code which would > take advantage of the standard locale module. > > For instance, it would be very nice if we could say something like: > > # does not work! > myISOCountryCode='hr' > locale.setlocale(locale.LC_ALL, (myISOCou

Re: On re / regex replacement

2011-08-28 Thread Vlastimil Brom
gex-hg/wiki/GeneralDetails#Additional_features for an overview of the additions. Personally I am very happy with regex, both with its features as well as with the support and maintenance by its developer; however I am mostly using it for manually entered patterns, and less for hardcoded operation. regards, Vlastimil Brom -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with regular expression in python

2011-08-22 Thread Vlastimil Brom
Sorry, if I missed some further specification in the earlier thread or if the following is oversimplification of the original problem (using 3 numbers instead of 32), would something like the following work for your data? >>> import re >>> data = """2.201000e+01 2.15e+01 2.199000e+01 : (instan

  1   2   3   >