With a dict like so:
cond = {'a': 1, 'b': 1, 'c': 1,
'A': 0, 'B', 0, 'C':0}
how would you make a boolean expression like this:
bool = (('a' == 1) ('A' == 0) |
('b' == 1) ('B' == 0) |
('c' == 1) ('C' == 0))
The fact that lowercase and uppercase keys are stringed
On Fri, 01 Aug 2014 12:45:12 +, Alex van der Spek wrote:
With a dict like so:
cond = {'a': 1, 'b': 1, 'c': 1,
'A': 0, 'B', 0, 'C':0}
how would you make a boolean expression like this:
bool = (('a' == 1) ('A' == 0) |
('b' == 1) ('B' == 0) |
('c' == 1
but leaves the outdat array unchanged.
Obviously I haven't understood ctypes well enough.
Returning arrays from FORTRAN I routinely do through a string_buffer.
That works very well but did not work here at all.
Any and all help welcome.
Alex van der Spek
--
https://mail.python.org/mailman
Many hours later I found a working solutions in ctypes:
The below makes sense to me but I am still at a loss why the first solution
did not work.
Anybody willing to explain for my better understanding?
Regards,
Alex van der Spek
_snns
works:
with open(os.path.join('path', 'foo.txt', 'rb') as txt:
reader = csv.reader(txt)
data = [row + [year] for row in reader]
However in this context I am baffled. If someone can explain what is
going on here, I would be most grateful.
Alex van der Spek
--
https://mail.python.org
On Wed, 12 Mar 2014 10:00:09 -0500, Zachary Ware wrote:
On Wed, Mar 12, 2014 at 9:25 AM, Alex van der Spek zd...@xs4all.nl
wrote:
I think I understand the difference between deep vs. shallow copies but
I was bitten by this:
with open(os.path.join('path', 'foo.txt', 'rb') as txt
have done that for a number of the dierckx routines. No problems at all.
Hope this helps,
Alex van der Spek
On Wednesday, April 24, 2013 11:13:45 AM UTC+2, Roozbeh wrote:
Hi all, I want to use spline interpolation function from SciPy in an
application and at the same time, I don't want the end
.
Can I change the comma (,) into a period (.) and if so how?
Thanks in advance,
Alex van der Spek
--
http://mail.python.org/mailman/listinfo/python-list
'])
Why does it fail on passing in a tuple of ignore strings? I thought the ,
(comma) is pretty much the tuple constructor (if that is the right word).
How can I solve this? Is there a way to convert a tuple of strings in a form
that will be accepted?
Thank you in advance,
Alex van der
is a
comma.
Can I change the comma (,) into a period (.) and if so how?
Thanks in advance,
Alex van der Spek
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 19 May 2012 01:59:59 +, Steven D'Aprano wrote:
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
I do not understand why the spooled write gives an error. See below.
The normal tempfile works just fine. They are supposed to behave equal?
All insight you can provide is welcome.
Alex van der Spek
+
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30
I am confused about the Wave_write object setsampwidth(n).
Is the sample width n the total sample width, i.e. for a stereo sample
consisting of short (2 byte) integers; n=4 or is the sample width the number
of bytes in either the left or the right channel?
Regards,
Alex van der Spek
When reading a tree and writing it back to a new file all the elements are
prepended with the string ns0:
Why is it prepended and how can I suppress this?
Thanks,
Alex van der Spek
--
http://mail.python.org/mailman/listinfo/python-list
=[(1,2,3),(4,5,6)]
arr=numpy.array(dat,dtype=col)
arr
array([(1.0, 2.0, 3.0), (4.0, 5.0, 6.0)],
dtype=[('a', 'f4'), ('b', 'f4'), ('c', 'f4')])
The only difference that the object is a list of tuples now?
Thanks for clarification,
Alex van der Spek
--
http://mail.python.org/mailman/listinfo
Is there an equivalent to os.path.walk() for HDF5 file trees accessed
through h5py?
Thanks!
Alex van der Spek
--
http://mail.python.org/mailman/listinfo/python-list
. I use the standard binaries as distributed.
Thanks in advance,
Alex van der Spek
--
http://mail.python.org/mailman/listinfo/python-list
across platforms (I use Python
2.7 on Win Vista)?
See code below.
Thanks for the insight!
Alex van der Spek
+++
from Tkinter import *
import tkFileDialog as tkf
tkroot=Tk()
tkroot.withdraw()
initdir=os.environ['HOME']
filetype=[('Binary Timeseries','*.bin'),('All files
not
appear to be a way to multiselect files?
I am probably missing a whole lot. Please point me to a simple example of
GUI file manipulations. I can save myself with os.path.walk and os.listdir
but the users I try to serve cannot.
Regards,
Alex van der Spek
--
http://mail.python.org/mailman
():
refd[k].append(v)
I do not understand why this appends v to every key k each time.
Thanks in advance for any tips you can pass on.
Alex van der Spek
--
http://mail.python.org/mailman/listinfo/python-list
Thank you! Would never have found that by myself.
Paul Rubin no.email@nospam.invalid wrote in message
news:7x7ha75zib@ruckus.brouhaha.com...
Alex van der Spek zd...@xs4all.nl writes:
refd=dict.fromkeys(csvr.fieldnames,[]) ...
I do not understand why this appends v to every key k each
.
dva.terminate()
however does work fine and kills the program as it should.
Is there a way or do I have to go back to Visual Basic?
Regards,
Alex van der Spek
--
http://mail.python.org/mailman/listinfo/python-list
in Python. The fact that I still use and can use FORTRAN
gives away my age. Mixed language programming is not an issue for me (C/VB,
VB/FORTRAN, C/FORTRAN) but Python is new. Just pointing me to relevant
documentation would be helpful in its own right.
Thank you in advance,
Alex van der Spek
Thanks all! I understand better now. I had no idea that EOFError was an
exception. I was looking for a function to tell me when the end of a
sequential file is reached as in all of the 4 programming languages that I
do know this is a requirement.
Will modify my program accordingly.
Alex van
.
If there is, I won't meet it for a while.
Alex van der Spek
D'Arcy J.M. Cain da...@druid.net wrote in message
news:mailman.2159.1281917130.1673.python-l...@python.org...
On 15 Aug 2010 23:33:10 GMT
Steven D'Aprano st...@remove-this-cybersource.com.au wrote:
Under what possible circumstances would you
van der Spek
--
http://mail.python.org/mailman/listinfo/python-list
?
Regards,
Alex van der Spek
D'Arcy J.M. Cain da...@druid.net wrote in message
news:mailman.2159.1281917130.1673.python-l...@python.org...
On 15 Aug 2010 23:33:10 GMT
Steven D'Aprano st...@remove-this-cybersource.com.au wrote:
Under what possible circumstances would you prefer this code
fileinput.nextfile()
fn+=1
print fileinput.filename().rsplit('\\',1)[1]
fileinput.close()
+++
Regards,
Alex van der Spek
Alex van der Spek zd...@xs4all.nl wrote in message
news:4c696751$0$22940
Looking for a method that does the opposite of 'split', i.e. elements in a
list are automatically concatenated with a user selectable spacer in between
e.g. '\t'. This is to prepare lines to be written to a sequential file by
'write'.
All hints welcome.
Regards,
Alex van der Spek
--
http
repositories.
Thanks in advance,
Alex van der Spek
--
http://mail.python.org/mailman/listinfo/python-list
. Please keep it simple
Thanks in advance,
Alex van der Spek
--
http://mail.python.org/mailman/listinfo/python-list
Is there a way to read C# serialized objects into Python?
I know the definition and structure of the C# objects. The Python docs
say that pickle is specific to Python, which does not give me much hope.
There may be a library however that I haven't come across yet.
Thanks much,
Alex van der
Thanks much, that makes sense! Alex van der Spek
--
http://mail.python.org/mailman/listinfo/python-list
33 matches
Mail list logo