y...@zioup.com wrote:
>
> I'm missing something about tkinter updates. How can I give tkinter a
> chance to run?
>
> Here's some code:
>
> import time
> import tkinter
> import tkinter.scrolledtext
>
> tk = tkinter.Tk()
> f = tkinter.Toplevel(tk)
> st = tkinter.scrolledtext.ScrolledText(f)
> s
tinn...@isbd.co.uk wrote:
> I have a small python program that uses the pyexiv2 package to view
> exif data in image files.
>
> I've hit a problem because I have a filename with accented characters
> in its path and the pyexiv2 code traps as follows:-
>
> Traceback (most recent call last):
>
contro opinion wrote:
> how can i get "你好" from '\xc4\xe3\xba\xc3' ?
>>> print '\xc4\xe3\xba\xc3'.decode("gbk")
你好
General rule: use the decode() method to convert from bytestring to unicode
and encode() to convert from unicode to bytestring.
bytestring.encode(x) will implicitly try
bytestrin
woooee wrote:
[Peter Otten]
>> line = next(infile, None)
>> if line is not None:
> if line is not None: probably does not work the way you expect.
It does what I expect.
> You might try
> if line.strip():
> Take a look at this quick example
>
> t
contro opinion wrote:
> please download the attachment ,and put in c:\test.data
Your data didn't make it through.
> and run the folloeing code:
>
> from struct import unpack
> file_obj = open('c:\\test.data', 'r')
Open the file in binary mode to disable CRNL-to-NL translation which will
corr
Prasad, Ramit wrote:
>>Like Neil mentioned, a contextmanager generator is wrapped with an
>>__exit__ method that is guaranteed to be called and that explicitly
>>resumes or closes the generator. So as long as your contextmanager
>>generator is properly written (i.e. it yields exactly once), the
>
Arnaud Delobelle wrote:
>> Em 01-02-2012 01:39, Paulo da Silva escreveu:
>>> What is the best way to iterate thru a huge list having the 1st element
>>> a different process? I.e.:
> Nobody mentioned itertools.islice, which can be handy, especially if
> you weren't interested in the first element
Ulrich Eckhardt wrote:
> Am 31.01.2012 19:09, schrieb Tim Arnold:
>> high_chars = {
>> 0x2014:'—', # 'EM DASH',
>> 0x2013:'–', # 'EN DASH',
>> 0x0160:'Š',# 'LATIN CAPITAL LETTER S WITH CARON',
>> 0x201d:'”', # 'RIGHT DOUBLE QUOTATION MARK',
>> 0x201c:'“', # 'LEFT DOUBLE QUOTATI
Russell E. Owen wrote:
> I have an odd and very intermittent problem in Python script.
> Occasionally it fails with this error:
>
> Traceback (most recent call last):
> File
> "/Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
> eFocusScript.py", line 884, in run
> File
>
Ulrich Eckhardt wrote:
> Am 01.02.2012 10:32, schrieb Peter Otten:
>> It doesn't matter for the OP (see Stefan Behnel's post), but If you want
>> to replace characters in a unicode string the best way is probably the
>> translate() method:
>>
>>>&
Antti J Ylikoski wrote:
> On 7.2.2012 14:13, Jean Dupont wrote:
>> ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1,
>> rtscts=0, dsrdtr=0, timeout=15)
>
> In Python, if you want to continue the source line into the next text
> line, you must end the line to be continued with a backs
smac2...@comcast.net wrote:
> Hello. I am admittedly a Python novice, and ran into some trouble
> trying to write a program that will pull multiple excel files all into
> one file, with each file on a different sheet.
>
> I am confident most of the code is correct, as the program runs
> without a
smac2...@comcast.net wrote:
> xls_files = glob.glob(in_dir + "*.xls")
Try changing that to
pattern = os.path.join(in_dir, "*.xls")
xls_files = glob.glob(pattern)
os.path.join() inserts a (back)slash between directory and filename if
necessary.
> merge_xls(in_dir="C:\Documents and Settings\
Chris Angelico wrote:
> On Thu, Feb 9, 2012 at 2:55 PM, Steven D'Aprano
> wrote:
>> If your data is humongous but only available lazily, buy more memory :)
>
> Or if you have a huge iterable and only need a small index into it,
> snag those first few entries into a list, then yield everything el
Mark Lawrence wrote:
> I'm looking at a way of cycling around a sequence i.e. starting at some
> given location in the middle of a sequence and running to the end before
> coming back to the beginning and running to the start place. About the
> best I could come up with is the following, any bett
jkn wrote:
> is it possible to have multiple namespaces within a single python
> module?
Unless you are abusing classes I don't think so.
> I have a small app which is in three or four .py files. For various
> reasons I would like to (perhaps optionally) combine these into one
> file.
Ren
noydb wrote:
> How do you format a number to print with commas?
>
> Some quick searching, i came up with:
>
import locale
locale.setlocale(locale.LC_ALL, "")
locale.format('%d', 2348721, True)
> '2,348,721'
>
>
> I'm a perpetual novice, so just looking for better, slicker, more
smac2...@comcast.net wrote:
> On Feb 7, 3:16 pm, Peter Otten <__pete...@web.de> wrote:
>> smac2...@comcast.net wrote:
>> > xls_files = glob.glob(in_dir + "*.xls")
>>
>> Try changing that to
>>
>> pattern = os.path.join(in_dir, &qu
Chris Rebert wrote:
> On Thu, Feb 9, 2012 at 12:39 PM, Peter Otten <__pete...@web.de> wrote:
>>>>> import locale
>>>>> locale.setlocale(locale.LC_ALL, "")
>> 'de_DE.UTF-8'
>>>>> "{:n}".format(1234) # loca
Ethan Furman wrote:
> Peter Otten wrote:
>> jkn wrote:
>>
>>> is it possible to have multiple namespaces within a single python
>>> module?
>>
>> Unless you are abusing classes I don't think so.
>
>
> Speaking of...
>
&
jkn wrote:
> Hi Peter
>
> On Feb 9, 7:33 pm, Peter Otten <__pete...@web.de> wrote:
>> jkn wrote:
>> > is it possible to have multiple namespaces within a single python
>> > module?
>>
>> Unless you are abusing classes I don't think so.
Andrea Crotti wrote:
> Ok now it's getting really confusing, I tried a small example to see
> what is the real behaviour,
> so I created some package namespaces (where the __init__.py declare the
> namespace package).
>
>/home/andrea/test_ns:
>total used in directory 12 available 5655372
Peter Otten wrote:
> If it's a.c/a, that does not contain a c submodule or subpackage.
Sorry, I meant a.b/a
--
http://mail.python.org/mailman/listinfo/python-list
Andrea Crotti wrote:
> On 02/10/2012 03:27 PM, Peter Otten wrote:
>> The package a will be either a.c/a/ or a.b/a/ depending on whether
>> a.c/ or a.b/ appears first in sys.path. If it's a.c/a, that does not
>> contain a c submodule or subpackage.
>
>
>
On 12 Feb 2012 09:12:57 GMT, Steven D'Aprano wrote:
>
> Suppose you're a fan of Russian punk bank Наӥв and you have a directory
> of their music.
Sigh. Banking ain't what it used to be. I'm sticking with
classical Muzak.
--
To email me, substitute nowhere->spamcop, invalid->net.
--
http://ma
Fabrizio Pollastri wrote:
> Ok. To be more clear, consider the real python package Pandas.
>
> This package defines a Series class and a DataFrame class.
> The DataFrame is a matrix that can have columns of
> different type.
>
> If I write
>
> import pandas as pd
> df = pd.DataFrame({'A':[1,2,3
Smiley 4321 wrote:
> I am a python newbie.
Welcome!
> Let's say I have a filename (test.conf) as below -
>
>
> int Apple(int, int);
> void Jump_OnUnload(float, int);
> int Jockey_Apple_cat_1KK(float, int, char, int);
> int Jockey_Apple_cat_look(int, float, int, int);
> int Jockey_Apple_ca
Brad Tilley wrote:
> In C or C++, I can do this for integer conversion:
>
> unsigned int j = -327681234; // Notice this is signed.
>
> j will equal 3967286062. I thought with Python that I could use struct
> to pack the signed int as an unsigned int, but that fails:
>
x = struct.pack(" Tra
JohannesTU wrote:
> Hello everyone,
>
> I'm new to linux/suse, but I was given the task to install the print
> accounting software PyKota.
> Before that I never even touched a linux system, so I don't have any basic
> knowlegde at all!
> Up to now I was able to solve all problems with the help of
Bruce Eckel wrote:
> Notice that both classes are identical, except that one inherits from
> dict (and works) and the other inherits from OrderedDict and fails.
> Has anyone seen this before? Thanks.
>
> import collections
>
> class Y(dict):
> def __init__(self, stuff):
> for k, v in
Marc Aymerich wrote:
> Hi,
>
> I'm playing a bit with python dynamic methods and I came up with a
> scenario that I don't understant. Considering the follow code:
>
> # Declare a dummy class
> class A(object):
> pass
>
> # generate a dynamic method and insert it to A class
> for name in ['a
Roy Smith wrote:
> In http://docs.python.org/release/2.6.7/library/logging.html, it says:
>
> logging.debug(msg[, *args[, **kwargs]])
> [...]
> There are two keyword arguments in kwargs which are inspected: exc_info
> which, if it does not evaluate as false, causes exception information to
> be a
Buck Golemon wrote:
> I feel like the design of sum() is inconsistent with other language
> features of python. Often python doesn't require a specific type, only
> that the type implement certain methods.
>
> Given a class that implements __add__ why should sum() not be able to
> operate on that
Ethan Furman wrote:
> Steven D'Aprano wrote:
>> On Thu, 23 Feb 2012 16:30:09 -0800, Alex Willmer wrote:
>>
>>> This week I was slightly surprised by a behaviour that I've not
>>> considered before. I've long used
>>>
>>> for i, x in enumerate(seq):
>>># do stuff
>>>
>>> as a standard looping-
Rick Johnson wrote:
> On Feb 23, 6:30 pm, Alex Willmer wrote:
>> [...]
>> as a standard looping-with-index construct. In Python for loops don't
>> create a scope, so the loop variables are available afterward. I've
>> sometimes used this to print or return a record count e.g.
>>
>> for i, x in en
Peter Otten wrote:
> The code in the else suite executes only when the for loop is left via
> break.
Oops, the following statement is nonsense:
> A non-empty iterable is required but not sufficient.
Let me try again:
A non-empty iterable is required but not sufficient to *skip*
Steven D'Aprano wrote:
>> The code in the else suite executes only when the for loop is left via
>> break. A non-empty iterable is required but not sufficient.
>
> You have a typo there. As your examples show, the code in the else suite
> executes only when the for loop is NOT left via break (or
Frank Millman wrote:
> I seem to have a recurring battle with circular imports, and I am trying
> to nail it once and for all.
>
> Let me say at the outset that I don't think I can get rid of circular
> imports altogether. It is not uncommon for me to find that a method in
> Module A needs to acc
Smiley 4321 wrote:
> If I have a sample python code to be executed on Linux. How should I
> handle multiple objects with 'pickle' as below -
>
> ---
> #!/usr/bin/python
>
> import pickle
>
> #my_list = {'a': 'Apple', 'b': 'Mango', 'c': 'Orange', 'd': 'Pineapple'}
> #my_list = ('Apple', 'Ma
Jason Veldicott wrote:
> Hi,
>
> I have a simple configuration of modules as beneath, but an import error
> is reported:
>
> /engine
>(__init__ is empty here)
>engine.py
> /sim
>__init__.py
>
>
> The module engine.py imports a variable instantiated in sim.__init__ as
> follows:
>
Andrea Crotti wrote:
> I have a script that might be used interactively but also has some
> arguments that
> should not be used by "normal" users.
> So I just want to suppress them from the help.
> I've read somewhere that the help=SUPPRESS should do what I want:
>
> parser.add_argument('-n'
Smiley 4321 wrote:
> Am I doing the right thing for -
>
> - Have a class
> - Instantiate the class with 3 parameters
> - pickle the class instance
> - generate a bytestream (.pkl) using pickle.dump, simply guessing -
>
> as -
>
> ---
> #!/usr/bin/python
>
> import pickle
>
> class Pickle:
>
crs...@gmail.com wrote:
> I'm new to Python but have experience with a few other programming
> languages(Java, Perl, JavaScript).
>
> I'm using Python 2.7.2 and I'm trying to create and write to a file (.py)
> a python class and functions from python. I will also need to later read
> and edit the
Andrea Crotti wrote:
> On 02/28/2012 04:02 PM, Peter Otten wrote:
>> Andrea Crotti wrote:
>>
>>> I have a script that might be used interactively but also has some
>>> arguments that
>>> should not be used by "normal" users.
>>>
crs...@gmail.com wrote:
> On Tuesday, February 28, 2012 9:56:43 AM UTC-8, Peter Otten wrote:
>> crs...@gmail.com wrote:
>>
>> > I'm new to Python but have experience with a few other programming
>> > languages(Java, Perl, JavaScript).
>> >
>&
Guillaume Chorn wrote:
> Hello All,
>
> I have a .csv file that I created by copying and pasting a list of all the
> players in the NBA with their respective teams and positions (
> http://sports.yahoo.com/nba/players?type=lastname&first=1&query=&go=GO!).
> Unfortunately, when I do this I have no
nd get:abcde
Problem is I can't figure out what extract_from would look like, such that it
would proceed dynamically down to the right level. I'm open to the possibility
that I'm not approaching this the right way.
If it helps, one member of my actual dict quoted below. So in real l
one member of my actual dict quoted below. So in real life,
something likedata_needed=['name','active-defects', 'admin-status:format',
'description', 'traffic-statistics:input-bps']etc.
Thanks in advance,Peter
{ 'ge-0/0/0': {'active-al
data from different levels of a dict
On Wed, Feb 29, 2012 at 7:56 PM, Peter Rubenstein
wrote:
> Hi,
>
> I'd appreciate a bit of help on this problem. I have some data that
> I've converted to a dict and I want to pull out individual pieces of it.
>
> Simplified version-
Rolf Wester wrote:
> The reason to use exec is just laziness. I have quite a lot of classes
> representing material data and every class has a number of parameters.
> The parameter are Magnitude objects (they have a value and a unit and
> overloaded special functions to correctly handle the units)
Prasad, Ramit wrote:
> Hi Peter,
>
> >>> class Magnitude(object):
>
> ... def __init__(self, value):
> ... self.value = value
> ... def __call__(self, uf=1):
> ... if uf == 1:
> ... return self
Neal Becker wrote:
> What happens if I pickle a class, and later unpickle it where the class
> now has added some new attributes?
- If the added attributes' values are immutable, provide defaults as class
attributes.
- Implement an appropriate __setstate__() method. The easiest would be
# unte
Bob Rossi wrote:
> On Tue, Mar 06, 2012 at 02:38:50AM -0800, Vinay Sajip wrote:
>> On Mar 6, 2:40 am, Bob Rossi wrote:
>>
>> > Darn it, this was reported in 2007
>> > http://bugs.python.org/issue1180193
>> > and it was mentioned the logging package was effected.
>> >
>> > Yikes.
>> >
>>
>> I wi
Steven D'Aprano wrote:
> On Tue, 06 Mar 2012 07:34:34 -0500, Neal Becker wrote:
>
>> What happens if I pickle a class, and later unpickle it where the class
>> now has added some new attributes?
>
> Why don't you try it?
>
> py> import pickle
> py> class C:
> ... a = 23
> ...
> py> c = C()
Neal Becker wrote:
> Peter Otten wrote:
>
>> Steven D'Aprano wrote:
>>
>>> On Tue, 06 Mar 2012 07:34:34 -0500, Neal Becker wrote:
>>>
>>>> What happens if I pickle a class, and later unpickle it where the class
>>>> now has adde
Gelonida N wrote:
> Is there anyhing like a built in signature which would help to detect,
> that one tries to unpickle an object whose byte code has changed?
No. The only thing that is stored is the "protocol", the format used to
store the data.
> The idea is to distinguish old and new pickle
bugzilla-mail-...@yandex.ru wrote:
> How can I get something from tkinter gui to another program ?
> tkinter on python 3.2 on kde4
How about
import tkinter
root = tkinter.Tk()
root.clipboard_clear()
root.clipboard_append("whatever")
--
http://mail.python.org/mailman/listinfo/python-list
cript gives the following error:
Exception ValueError: 'underlying buffer has been detached' in
Same in Python 3.1.4 and Python 3.2.2
So, what do I do if I want to send binary data to stdout?
--
Peter Kleiweg
http://pkleiweg.home.xs4all.nl/
--
http://mail.python.org/mailman/listinfo/python-list
-up, type(sys.stdout) is
, and it's also after using the
second method.
After using the first method, type(sys.stdout) is changed to
.
Should I always use the second method?
--
Peter Kleiweg
http://pkleiweg.home.xs4all.nl/
--
http://mail.python.org/mailman/listinfo/python-list
Dave Angel schreef op de 7e dag van de lentemaand van het jaar 2012:
> On 03/07/2012 02:41 PM, Peter Kleiweg wrote:
> > I want to write out some binary data to stdout in Python3. I
> > thought the way to do this was to call detach on sys.stdout. But
> > apparently, you can
Maarten wrote:
> Alternatively you can figure out the parent class with a call to super:
This is WRONG:
> super(self.__class__, self).__init__()
You have to name the current class explicitly. Consider:
>> class A(object):
... def __init__(self):
... print "in a"
...
>>
Tobiah wrote:
> I'm pulling image data from a database blob, and serving
> it from a web2py app. I have to send the correct
> Content-Type header, so I need to detect the image type.
>
> Everything that I've found on the web so far, needs a file
> name on the disk, but I only have the data.
>
>
Gelonida N wrote:
> I want to know whether two .pyc files are identical.
>
> With identical I mean whether they contain the same byte code.
>
> Unfortunately it seems, that .pyc files contain also something like the
> time stamp of the related source file.
>
> So though two pyc files contain th
Ian Kelly wrote:
> On Sun, Mar 11, 2012 at 5:40 AM, Ian Kelly wrote:
>>> 2. Is the mro function available only on python3?
>>
>> No, but it is available only on new-style classes. If you try it on a
>> classic class, you'll get an AttributeError.
>
> And by the way, you probably shouldn't call
Darrel Grant wrote:
> In the virtualenv example bootstrap code, a global join function is used.
>
> http://pypi.python.org/pypi/virtualenv
At this point there is probably an import that you have overlooked:
from os.path import join
> subprocess.call([join(home_dir, 'bin', 'easy_install'),
Prasad, Ramit wrote:
> So I have a context manager used to catch errors
>
> def __exit__( self, exceptionClass, exception, tracebackObject ):
> if isinstance( exception, self.exceptionClasses ):
> #do something here
>
> Normally exception would be the exception instance, but for
> A
Prasad, Ramit wrote:
>> Prasad, Ramit wrote:
>>
>> > So I have a context manager used to catch errors
>> >
>> > def __exit__( self, exceptionClass, exception, tracebackObject ):
>> > if isinstance( exception, self.exceptionClasses ):
>> > #do something here
>> >
>> > Normally excepti
Dear Sirs,
I am a new student learning this and am getting an Android tablet for my
birthday will python be able to run on android?
Kindest regards
Peter
This email and any attachments to it may contain information which is
confidential, legally privileged, subject to the Official
Cosmia Luna wrote:
> I'm porting my existing work to Python 3.X, but...
>
> class Foo:
> def bar(self):
> pass
>
> mthd = Foo.bar
>
> assert mthd.im_class is Foo # this does not work in py3k
>
> So, how can I get a reference to Foo? This is important when writing
> decorators, the
Steven D'Aprano wrote:
> On Sat, 17 Mar 2012 11:42:49 -0700, Eric Snow wrote:
>
>> On Sat, Mar 17, 2012 at 4:18 AM, Steven D'Aprano
>> wrote:
>>> Note that it is important for my purposes that MockChainMap does not
>>> inherit from dict.
>>
>> Care to elaborate?
>
> I want to use collections.C
Christian wrote:
> as beginner in python , I struggle somewhat to filter out only the
> maximum in the values for and get hmax.
> h = {'abvjv': ('asyak', 0.9014230420411024),
> 'afqes': ('jarbm', 0.9327883839839753),
> 'aikdj': ('jarbm', 0.9503941616408824),
> 'ajbhn': ('jarbm', 0.932358308
J. Mwebaze wrote:
> I am trying to learn about the interaction between python objects. One
> thing i have often read is that objects interact by sending messages to
> other objects to invoke corresponding methods. I am specifically
> interested in tracing these messages and also probably log the m
prince.pangeni wrote:
> Hi all,
>I am doing a simulation project using Python. In my project, I want
> to use some short of distribution to generate requests to a server.
> The request should have two distributions. One for request arrival
> rate (should be poisson) and another for request mix
Joi Mond wrote:
> Can someone help me with the proper code to compute combinations for n=7,
> r=5 for the following list of numbers: 7, 8, 10, 29, 41, 48, 55. There
> should be 21 combination. Also once there list is made can a code be
> written to add (sum) each of the set of five number in the t
Rod Person wrote:
> We have a module called constants.py, which contains [whatever] related to
> server names, databases, service account users and their passwords.
Passwords?
> In order to be able to use constants as command line parameters for
> calling from our batch files I created the class
Sangeet wrote:
> I've been trying to write a script that would access the last modified
> file in one of my directories. I'm using Win XP.
import os
import glob
path = r"c:\one\of\my directories\*"
youngest_file = max(glob.glob(path), key=os.path.getmtime)
--
http://mail.python.org/mailman/li
Ethan Furman wrote:
> Nathan Rice wrote:
>> Logo. It's turtles all the way down.
>
> +1 QOTW
Surely you're joking, Mr Furman!
--
http://mail.python.org/mailman/listinfo/python-list
Nikhil Verma wrote:
> I want something to achieve like this :-
>
> def random_number(id): # I am passing it from request
> # do something
> return random_number
>
> Output
>
> random_number(5)
> AXR670
That's normally not called a number (though it could be base 36 or similar).
> One
redstone-c...@163.com wrote:
> I know the print statement produces the same result when both of these two
> instructions are executed ,I just want to know Is there any difference
> between print 3 and print '3' in Python ?
The question you really wanted to ask is: under what circumstances will th
Hi,
is there any way to convert a string to bytes without
interpreting the data in any way? Something like:
s='abcde'
b=bytes(s, "unchanged")
Regards,
Peter
--
http://mail.python.org/mailman/listinfo/python-list
On 2012-03-28 11:02, Chris Angelico wrote:
> On Wed, Mar 28, 2012 at 7:56 PM, Peter Daum wrote:
>> is there any way to convert a string to bytes without
>> interpreting the data in any way? Something like:
>>
>> s='abcde'
>> b=bytes(s, "unchang
Jabba Laci wrote:
> Is the following function correct?
Yes, though I'd use json.load(f) instead of json.loads().
> Is the input file closed in order?
>
> def read_data_file(self):
> with open(self.data_file) as f:
> return json.loads(f.read())
The file will be closed when the wit
On 2012-03-28 12:42, Heiko Wundram wrote:
> Am 28.03.2012 11:43, schrieb Peter Daum:
>> ... in my example, the variable s points to a "string", i.e. a series of
>> bytes, (0x61,0x62 ...) interpreted as ascii/unicode characters.
>
> No; a string contains a series
Ben Finney wrote:
> Steven D'Aprano writes:
>
>> (By the way, I have to question the design of an exception with error
>> codes. That seems pretty poor design to me. Normally the exception *type*
>> acts as equivalent to an error code.)
>
> Have a look at Python's built-in OSError. The various
Ulrich Eckhardt wrote:
> True. Normally. I'd adapting to a legacy system though, similar to
> OSError, and that system simply emits error codes which the easiest way
> to handle is by wrapping them.
If you have
err = some_func()
if err:
raise MyException(err)
the effort to convert it to
e
ogateescape" without the "_" and in python 3.1 it exists, but only
not as a keyword argument: "s=b.decode('utf-8','surrogateescape')" ...)
Thank you very much for your constructive advice!
Regards,
Peter
--
http://mail.python.org/mailman/listinfo/python-list
larry.mart...@gmail.com wrote:
> I have the following use case:
>
> I have a set of data that is contains 3 fields, K1, K2 and a
> timestamp. There are duplicates in the data set, and they all have to
> processed.
>
> Then I have another set of data with 4 fields: K3, K4, K5, and a
> timestamp.
jkn wrote:
> I'm clearly not understanding the 'can't pickle instancemethod
> objects' error; can someone help me to understand,
I think classes implemented in C need some extra work to make them
picklable, and that hasn't been done for instance methods.
> & maybe suggest a
> workaround, (
On 3/30/2012 4:27 AM, Xah Lee wrote:
Is Programing Art or Science?
Programming itself is a bit like being a natural language translator for
an autistic person. You have to understand the "message" to be
communicated, and then interpret it *very* literally for the listener.
Note that progra
jkn wrote:
> Hi Peter
>
> On Apr 3, 8:54 am, Peter Otten <__pete...@web.de> wrote:
>> jkn wrote:
>> > I'm clearly not understanding the 'can't pickle instancemethod
>> > objects' error; can someone help me to understand,
>>
>
python wrote:
> I played around with a few things and this works but was wondering if
> there was a better way to do this.
> My first thought was list comprehension but could not get a figure out
> the syntax.
>
> tag23gr is a list of lists each with two items.
> g23tag is an empty dictionary whe
On Sun, 8 Apr 2012 16:58:01 -0700 (PDT), Scott Siegler wrote:
[snip]
> I set rect.left to 30, rect.top to 30 and rect.width = 20
>
> This works fine. However, when looking at rect.right() it
> shows that it is equal to 50. I suppose this is equal to
> 30+20. However, since the first pixel is on l
tkp...@gmail.com wrote:
> I using Python 3.2 and have a dictionary
d = {0:[1,2], 1:[1,2,3], 2:[1,2,3,4]}
>
> whose values are lists I would like to zip into a list of tuples. If I
> explicitly write:
list(zip([1,2], [1,2,3], [1,2,3,4])
> [(1, 1, 1), (2, 2, 2)]
>
> I get exactly what I
Alexander Blinne wrote:
> zip(*[x[1] for x in sorted(d.items(), key=lambda y: y[0])])
Why not zip(*[x[1] for x in sorted(d.items())])?
--
http://mail.python.org/mailman/listinfo/python-list
Lee Chaplin wrote:
> Hi all,
>
> I am trying to sort, in place, by column, a csv file AND sort it case
> insensitive.
> I was trying something like this, with no success:
>
> import csv
> import operator
>
> def sortcsvbyfield(csvfilename, columnnumber):
> with open(csvfilename, 'rb') as f:
>
Kiuhnm wrote:
> On 4/16/2012 4:42, Steven D'Aprano wrote:
>> On Sun, 15 Apr 2012 23:07:36 +0200, Kiuhnm wrote:
>>
>>> This is the behavior I need:
>>> path = path.replace('\\', '')
>>> msg = ". {} .. '{}' .. {} .".format(a, path, b)
>>> Is there a better way?
>>
>>
>> This works fo
Python Email wrote:
> how do i merge two seqs alernative;
>
> ("xyz", "7890")
> output: x7y8z90
>>> import itertools
>>> "".join(a+b for a, b in itertools.izip_longest("xyz", "7890",
fillvalue=""))
'x7y8z90'
--
http://mail.python.org/mailman/listinfo/python-list
Sania wrote:
> Hi,
> So I am trying to get the number of casualties in a text. After 'death
> toll' in the text the number I need is presented as you can see from
> the variable called text. Here is my code
> I'm pretty sure my regex is correct, I think it's the group part
> that's the problem.
N
Sania wrote:
> So I am trying to get the number of casualties in a text. After 'death
> toll' in the text the number I need is presented as you can see from
> the variable called text. Here is my code
> I'm pretty sure my regex is correct, I think it's the group part
> that's the problem.
No. A r
Ervin Hegedüs wrote:
> On Wed, Apr 18, 2012 at 10:41:00PM +0200, Peter Otten wrote:
>> Python Email wrote:
>>
>> > how do i merge two seqs alernative;
>> >
>> > ("xyz", "7890")
>> > output: x7y8z90
>>
>> >
501 - 600 of 9315 matches
Mail list logo