Tommy Grav kirjoitti:
snip
Thanks for the great response.
So how would you handle this type of error handling?
My main problem is that occasionally there is an entry
in the list that is a string:
0.9834 134.4933 78.009 run11 27
Again I would like to avoid having to individually parse
iwl kirjoitti:
Hi,
I tryed askstring to input some text in my script,
but some ugly empty Window appears with the
Input-Window behind and all together behind my
Console showing my script. So all have to brought
to the top first by the user - very unconfortable
Are you asking about the
iwl kirjoitti:
On 6 Mrz., 14:48, Tim Golden [EMAIL PROTECTED] wrote:
On Mar 6, 1:13 pm, iwl [EMAIL PROTECTED] wrote:
It's not clear whether you're talking about the usual
Why do I get a DOS window when I run my python script?
question -- to which the answer is, in essence, change
your
Jussi Salmela kirjoitti:
snip
Every GUI implementation has a command loop and things to initiate the
OOPS: an EVENT loop
Cheers,
Jussi
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] kirjoitti:
Hi,
I have the following tuple -
t = (one,two)
And I can build a dictionary from it as follows -
d = dict(zip(t,(False,False)))
But what if my tuple was -
t = (one,two,three)
then I'd have to use -
d = dict(zip(t,(False,False,False)))
Robin Becker kirjoitti:
Björn, in one of our projects we are sorting in javascript in several
languages English, German, Scandinavian languages, Japanese; from
somewhere (I cannot actually remember) we got this sort spelling
function for scandic languages
a
.replace(/\u00C4/g,'A~')
Shawn Milo kirjoitti:
snip
I am not looking for the smallest number of lines, or anything else
that would make the code more difficult to read in six months. Just
any instances where I'm doing something inefficiently or in a bad
way.
I'm attaching both the Perl and Python versions, and
rzed kirjoitti:
[EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
lialie:
The formated file may be very popularly, but the module
ConfigPaser doesn't handle it. Is there a way to process it
freely?
First try, assuming the input file can be read whole. The code
isn't much readable, it
Bart Ogryczak kirjoitti:
On Mar 1, 7:52 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
It seems like this would be easy but I'm drawing a blank.
What I want to do is be able to open any file in binary mode, and read
in one byte (8 bits) at a time and then count the number of 1 bits in
that
Duncan Booth kirjoitti:
Dennis Lee Bieber [EMAIL PROTECTED] wrote:
For floating point, smallest magnitude to largest IS the most
precise.
Pretend you only have 2 significant digits of precision...
10 + 0.4 + 0.4 + 0.4 = 10
0.4 + 0.4 + 0.4 + 10 = 11
and if you try
[EMAIL PROTECTED] kirjoitti:
snip
global names seemed to be the best idea. The only problem is now I
have to type common.r.t instead of just r.t. If I put common in the /
lib directory, it is even worse and I have to type lib.common.r.t. I
like that it is explicit and perhaps this is the
[EMAIL PROTECTED] kirjoitti:
On Feb 27, 12:07 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
In [EMAIL PROTECTED], [EMAIL PROTECTED]
wrote:
File ./scripts/regressionTest.py, line 30, in getSnapShot
if (difflib.context_diff(f1.readlines(), f2.readlines()).len() ==
0):
Paddy kirjoitti:
On Feb 25, 2:01 am, [EMAIL PROTECTED] wrote:
While working with lists of tuples is probably very common, none of my
five Python books or a Google search tell me how to refer to specific items
in each tuple. I find references to sorting a list of tuples, but not
extracting
Harlin Seritt kirjoitti:
Hi...
I would like to take a string like 'supercalifragilisticexpialidocius'
and write it to a file in binary forms -- this way a user cannot read
the string in case they were try to open in something like ascii text
editor. I'd also like to be able to read the
Steven D'Aprano kirjoitti:
On Wed, 21 Feb 2007 16:46:19 -0800, Harlin Seritt wrote:
WARNING: THIS IS NOT A STRONG ENCRYPTION ALGORITHM. It is just a
nuisance for someone that really wants to decrypt the string. But
it might work for your application.
-Larry
Thanks Larry! I was looking
[EMAIL PROTECTED] kirjoitti:
Hi,
Lists say I have the following tuple -
t1 = (ONE,THREE,SIX)
and then the following tuples -
t2 = (ONE,TWO,THREE)
t3 = (TWO,FOUR,FIVE,SIX)
t4 = (TWO,)
t5 = (TWO,FIVE)
What I want to do is return true if any member of tuple t1 is found in
Andy Watson kirjoitti:
I have an application that scans and processes a bunch of text files.
The content I'm pulling out and holding in memory is at least 200MB.
I'd love to be able to tell the CPython virtual machine that I need a
heap of, say 300MB up front rather than have it grow as
Larry Bates kirjoitti:
Wolfgang Draxinger wrote:
Jussi Salmela wrote:
I'm not claiming the following to be more elegant, but I would
do it like this (not tested!):
src_file_paths = dict()
prefix = sourcedir + os.sep
for fname in os.listdir(sourcedir):
if match_fname_pattern(fname
hiro kirjoitti:
Hey there, I'm currently doing data preprocessing (generating lagged
values for a time series) and I'm having some difficulties trying to
write a file to disk. A friend of mine, wrote this quick example for
me:
snip
tweaked code:
Wolfgang Draxinger kirjoitti:
H folks,
I got, hmm not really a problem, more a question of elegance:
In a current project I have to read in some files in a given
directory in chronological order, so that I can concatenate the
contents in those files into a new one (it's XML and I have to
Wolfgang Draxinger kirjoitti:
Jussi Salmela wrote:
I'm not claiming the following to be more elegant, but I would
do it like this (not tested!):
src_file_paths = dict()
prefix = sourcedir + os.sep
for fname in os.listdir(sourcedir):
if match_fname_pattern(fname):
fpath
Grant Edwards kirjoitti:
On 2007-02-12, Larry Bates [EMAIL PROTECTED] wrote:
Grant Edwards wrote:
On 2007-02-12, Larry Bates [EMAIL PROTECTED] wrote:
On 2007-02-12, Larry Bates [EMAIL PROTECTED] wrote:
I at least need the code for useing some library for
connecting to acrobat reader and
Dennis Lee Bieber kirjoitti:
On Tue, 13 Feb 2007 08:44:18 GMT, Jussi Salmela
[EMAIL PROTECTED] declaimed the following in comp.lang.python:
On Windows, this (where fileName is xyz.PDF, for example):
webbrowser.open(r'file://' + fileName)
starts Acrobat Reader with the document read
Shawn Milo kirjoitti:
To the list:
I have come up with something that's working fine. However, I'm fairly
new to Python, so I'd really appreciate any suggestions on how this
can be made more Pythonic.
Thanks,
Shawn
Okay, here's what I have come up with:
What follows may
jeremito kirjoitti:
On Feb 7, 8:28 am, jeremito [EMAIL PROTECTED] wrote:
On Feb 6, 5:10 pm, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
jeremito a écrit :
On Feb 6, 2:36 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote:
(snip)
Here's an alternative implementation, so you get the
Jan Danielsson kirjoitti:
Hello all,
I have some data in a postgresql table which I view through a web
interface (the web interface is written in python -- using mod_python
under apache 2.2). Now I would like to represent this data as graphs,
bar charts, etc.
I know about
[EMAIL PROTECTED] kirjoitti:
gurus:
I want to implement a sql-like sort-by on multiple keys. I've seen
many examples of just two keys.
I have a list like this
1 one 2
1 one 1
1 two 1
1 one 0
1 xx 0
result should be like this
1 four 2
1 one 0
1 one 1
1 one 2
1 xx 0
metaperl kirjoitti:
For this program:
def reverse(data):
for index in range(len(data)-1, -1, -1):
yield data[index]
r = reverse(golf)
for char in r:
print char
I'm wondering if the line:
r = reverse(golf)
demands the contents of the function reverse() all at
Stef Mientki kirjoitti:
Is it possible to change the searchpath for modules on the flight,
under winXP ?
What do you mean by *on the flight*: inside IDLE? using the command line?
Most preferred is some command to extend the searchpath.
(the environment variable PYTHONPATH needs a reboot)
No,
[EMAIL PROTECTED] kirjoitti:
Jussi Salmela:
In this particular case you don't need the ternary operator:
print I saw %d car%s\n % (n, (, s)[n != 1])
The last newline is probably unnecessary. This seems be a bit more
readable:
print I saw, n, car + (, s)[n != 1]
With Python 2.5
Peter Otten kirjoitti:
Isn't that obvious? Don't do it in one line:
if n == 1:
print I saw a car
else:
print I saw %d cars % n
I guess that most of us will have read, understood, and verified (are there
any errors or cases that should be covered but aren't) those four lines
Holger kirjoitti:
I would like to do the equivalent if python of the C line:
printf(I saw %d car%s\n, n, n != 1 ? s : )
Please help
/Holger
In this particular case you don't need the ternary operator:
print I saw %d car%s\n % (n, (, s)[n != 1])
Cheers,
Jussi
--
Gigs_ kirjoitti:
hi people
I have problem with this example, not actually the problem, but
[code]
class FileVisitor(object):
def __init__(self, data=None):
self.context = data
def run(self, startdir=os.curdir):
os.path.walk(startdir, self.visitor, None)
def
James Stroud kirjoitti:
snip
For instance, I have a copy_files section of a configuration. In order
to know what goes with what you have to resort to gymnastics with the
option names
[copy_files]
files_dir1 = this.file that.file
path_dir1 = /some/path
files_dir2 = the_other.file
Victor Polukcht kirjoitti:
Great thanks.
You post helped me so much!
My resulting regexp is:
(?Pvar1^(.*)\s*)\(((?Pvar2\d+))\)\s+((?Pvar3\d+))
If it doesn't have to be a regex:
#===
s = '''\
Unassigned Number (1)
Victor Polukcht kirjoitti:
I have 2 strings:
Global etsi3 *200 ok30 100% 100%
Outgoing
and
Global etsi3 * 4 ok 30 100% 100%
Outgoing
The difference is *200 instead of * 4. Is there ability to write a
regular expression that
[EMAIL PROTECTED] kirjoitti:
I think the sort has to be simplified, otherwise it can't keep the heap
invariant...
def sort(self):
self.h.sort()
Bye,
bearophile
And __repr__ should be something like this:
=
def __repr__(self):
if self.h:
return
W. Watson kirjoitti:
Gabriel Genellina wrote:
On 7 ene, 16:20, W. Watson [EMAIL PROTECTED] wrote:
We seem to be looping. I have the Python interpreter. I would like the
pythonwin editor. The download link doesn't work on SourceForge.
Where can I
get it? If not there, where? If it can't be
Neil Cerutti kirjoitti:
On 2007-01-08, hg [EMAIL PROTECTED] wrote:
sturlamolden wrote:
The designers of Java, C++, C#, Ada95, Delphi, etc. seem to think that
if an object's 'internal' variables or states cannot be kept private,
programmers get an irresistible temptation to mess with them in
W. Watson kirjoitti:
Thomas Ploch wrote:
snip
https://sourceforge.net/projects/pywin32/
I think this is the place to go
Thomas
That gets me the python program (pywin), which I got from a URL in a
post above (python-win.msi). I guess these are the same or at least just
the
Stef Mientki kirjoitti:
In this exercise, I don't attempt to write beautiful Python code,
but the first thing is to write a simple user-interface for non-Pythians.
I understand that standardization about naming conventions is important,
but the purpose here is to serve the user, who has to
W. Watson kirjoitti:
Gabriel Genellina wrote:
On 7 ene, 13:22, W. Watson [EMAIL PROTECTED] wrote:
https://sourceforge.net/projects/pywin32/
As I understand it, there are two files I'm after: 1. python
interpreter,
and 2. a python editor. It's #2 that I'm having trouble downloading. The
gonzlobo kirjoitti:
Curious if anyone has a python cheatsheet* published? I'm looking for
something that summarizes all commands/functions/attributes. Having
these printed on a 8 x 11 double-sided laminated paper is pretty
cool.
* cheatsheet probably isn't the right word, but you get the
Michael M. kirjoitti:
How to find the longst element list of lists?
I think, there should be an easier way then this:
s1 = [q, e, d]
s2 = [a, b]
s3 = [a, b, c, d]
snip
After, the list ist sorted:
sx1 = [a, b, c, d]
sx2 = [q, e, d]
sx3 = [a, b]
s1 = [q, e, d]
s2 =
Bruno Desthuilliers kirjoitti:
Stef Mientki a écrit :
How should I overload / disable a method ?
In the example below I have defined the class Power_Supply, derived
from baseclass device.
off
Naming conventions are to use CamelCase for class names. So it would be
better to name your
Bruno Desthuilliers kirjoitti:
Stef Mientki a écrit :
In the example below, pin is an object with a number of properties.
Now I want
1- an easy way to create objects that contains a number of these pin
2- an multiple way to access these pin, i.e.
device.pin[some_index]
License. See License.txt. If that file is not attached,
the license is http://www.opensource.org/licenses/mit-license.php,
where
year = 2006 and copyright holders = Jussi Salmela, Turku, Finland
'''
# This program checks for new email at ISP and notifies if new email is
found
import
Demel, Jeff kirjoitti:
If I were you, I'd think up a project and just build it. The best way
to really learn is to do, at least for me. If you run into problems,
then you can come back and ask the group here. Believe me, I've asked
some very basic questions, and everyone's been very
wcc kirjoitti:
Hello,
How do I create a class using a variable as the class name?
For example, in the code below, I'd like replace the line
class TestClass(object):
with something like
class eval(className) (object):
Is it possible? Thanks for your help.
className = TestClass
Roland Hedberg kirjoitti:
Hi!
I'm having a bit of a problem with import.
I'm writing a marshalling system that based on a specification will
create one or more files containing mostly class definitions.
If there are more than one file created (and there are reasons for
creating more
hg kirjoitti:
mm wrote:
Yes, it was the (), equivalent to thiks like new() create new object
from class xy.
s1.append(Word)
s1.append(Word())
But I was looking for a struct equivalent like in c/c++.
And/or union. I can't find it.
Maybe you know a source (URL) Python for c/c++
Lad kirjoitti:
Thank you for ALL for help.
Hendrik,
your solution works great but
what is `_` in
_.replace(',',', ')
for?
When you are trying things out in the Python shell IDLE, _ is a
shorthand way to use the last value printed by IDLE.
Thus when
s.replace(', ',',')
prints
Gert Cuykens kirjoitti:
Is there a difference between
code
class HelloWorld:
def index(self):
index.exposed = True
return Hello world!
/code
and
code
class HelloWorld:
def index(self):
self.exposed = True
return Hello world!
/code
The resident experts seemingly being
Huayang Xia kirjoitti:
It will print 15. The closure gets the value at run time.
Could we treat closure as part of the external function and it shares
the local variable with its holder function?
I don't quite get what you are trying to tell us but if you think that
in your example code:
client'. It has an example to get you started.
HTH,
Jussi Salmela
--
http://mail.python.org/mailman/listinfo/python-list
()
to each item it prints.
Cheers,
Jussi Salmela
--
http://mail.python.org/mailman/listinfo/python-list
linuxfreak wrote:
hi guys,
just starting out on python and libgmail... any documentation for
libgmail outthere... basically what i want to do is develop an
application to use gmail like and ftp server... should be able to
upload files and download them as well
thanks
My browser
linuxfreak wrote:
Funny enough I find the same Google in my browser too. and if my
memory serves me correct I did the same search which you allude to. It
is only after series of exhaustive searches rummaging through websites
with incomplete (or non existent ) docs that i posed the question
[EMAIL PROTECTED] wrote:
RawData = open('/Python25/working/data.txt', 'r')
You open this file only once. The first time in here:
def PullHourlyData(filename, facility, unit):
for line in filename:
reads all of the file - nothing left for the other function calls!
A better way would
Ara Kooser wrote:
snip
When I run the python program it works fine until I try to go west
from my inital start room. I get the room description but no raw_input
prompt. I just get dumped back to in the python shell. I think I
am missing something simple. I pasted in the code below. I am
.
Cheers,
Jussi
--
Jussi Salmela
http://personal.inet.fi/cool/operator/
--
http://mail.python.org/mailman/listinfo/python-list
61 matches
Mail list logo