back would be welcome, so that I
don't devote too much more time down a bad route.
thanks, matt
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
array([np.dot(a, b) for a, b in zip(A_new, B_new)])
print C
I'm certain there is a more clever way (ie. some function within numpy)
to do that last part.
matt
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
data:
print line["/pph2_prob/"]
Once you've got that working you just need to put the results in a file,
instead of printing them.
On a practical note (and there may be many reasons why not to), it might
be easier to open in a spreadsheet and take t
deepcopy of obj1 in the above
example if your obj1 contained other objects? I think that Steven's
class method gets around this?
thanks, matt
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.pytho
It's probably something very obvious that I'm
missing. My real use case is using the Python bindings to GDAL and
trying to create a subclass of gdal.Band which can't be instantiated
directly.
thanks, matt
___
Tutor maillist - Tutor@py
just didn't know how to return a SubSpam instance that was
forced to go through SpamMaker.make_spam().
matt
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Mon, Sep 24, 2012 at 9:41 AM, Benjamin Fishbein
wrote:
> Hello. I can run programs in IDLE but when I try to do it in a terminal or
> with textwrangler, it usually just logs out and says it's completed, but the
> program hasn't been run. This is particularly so when the program uses
> urllib
[]
for row in reader:
inData.append[row]
ifile.close()
you can now loop through inData to your heart's desire.
HTH,
Matt
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Personally I would start with Python 2.7, and start with simple scripts.
The standard library in Python is very "wide", and having a good
understanding of what is already there is very useful.
As to GUI/ Web/ etc. - I think it depends on what you want to do. However,
you will need the basics befo
cases, you
can alter your code and add the edge cases to the test data. That way, the
test data acts to cover the space of various oddities in your work.
I would be very keen to hear other ideas,
BW,
Matt
On Thu, 28 Jan 2016 20:12 Danny Yoo wrote:
> On Thu, Jan 28, 2016 at 12:44 AM, Alan Gauld
Just as a note - you are not the only person caught out by this - it is a
very common slip.
I wonder whether it would be worth adding a more explicit line about this
in the Python Docs?
Matt
On Wed, 3 Feb 2016 16:13 Ek Esawi wrote:
> Hi All
>
>
>
>
>
> I have a code that
I teach an introductory programming course to medical students (and a few
doctors).
I would look at Sublime Text 2 if one Windows/ Mac. Has a 'nag' screen to
remind you to buy, but feels simple enough when you start it.
M
On Wed, 2 Mar 2016 19:50 Ben Finney, wrote:
> Lisa Hasler Waters writes
Can someone recommend an open-source editor for all 3 platforms?
M
On Wed, 2 Mar 2016 21:37 Ben Finney, wrote:
> Ben Finney writes:
>
> > Short of [the heavyweights Vim and Emacs], I'd still recommend a
> > community-owned, free-software, highly flexible programmer's editor.
> > If you're on G
No, but in his defence, I can imagine someone reading the dissertation
and asking for a citation..
(Apologies for TP).
M
On 15/03/2016 18:43, Alan Gauld wrote:
On 15/03/16 11:45, Holderness, Ellie wrote:
How do I cite Python for my dissertation bibliography?
I used version 3.5.1.
I'm not
via d2.
I found some answers on StackOverflow which I need to have a longer look
at, but I would be grateful for any thoughts.
Thanks,
Matt
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org
On 2016-04-30 11:30, Olaoluwa Thomas wrote:
> I would appreciate a logical explanation for why the "else" statement in
> the 2nd script isn't working properly.
>
> I'm running Python v2.7.8 on a Windows 7 Ultimate VM via Command prompt and
> my scripts are created and edited via Notepad++ v6.7.3
>
Hello-
On 2016-09-20 11:48, Gabriele Brambilla wrote:
> does it mean that my number of points is too high?
In short, yes. From your usage of the 'print' statement, you are running
the code under Python 2.x. In this version of Python, the 'range'
function creates a full list of numbers, and so you
On 10/26/2016 02:06 PM, Wish Dokta wrote:
> Hello,
>
> I am currently writing a basic program to calculate and display the size of
> folders with a drive/directory. To do this I am storing each directory in a
> dict as the key, with the value being the sum of the size of all files in
> that directo
Use the str() function.
M
On Thu, 15 Dec 2016, 07:56 Bryon Adams, wrote:
> Is there a way to force my argument to always be a string before
> entering the function? Else, is there a better way to go about this? In
> whatever program I write, I could change what I want as input to be a
> string
the values. I need this log so the
data can easily be worked on in excel or SAS. I need the time/date
stamp for time series analysis.
I attached the code behind the wxPythoin GUI I am using.
Any help will be much appreciated.
Thanks in advance
--
Matt D
#!/usr/bin/env python
On 06/10/2013 12:23 PM, Prasad, Ramit wrote:
> Matt D wrote:
>> Ramit Prasad wrote:
>>>>> Scrolled panel is just a graphical container that allows for scrolling
>>>>> inside,
>>>>> but it is the window that scrolls not widgets inside it. Th
On 06/12/2013 05:59 PM, Dave Angel wrote:
> On 06/12/2013 05:32 PM, Matt D wrote:
>> On 06/10/2013 12:23 PM, Prasad, Ramit wrote:
>>> Matt D wrote:
>>>> Ramit Prasad wrote:
>>>>>>> Scrolled panel is just a graphical container that allows for
>
> There are other ways a script might change the current directory. For
> example, some naive scripts use os.chdir()
>
> But how is it you don't know what the current directory was when the
> code ran? A simply pwd can tell you, if your prompt doesn't already
> reveal it.
>
>
hey i found the
Original Message
Subject: Re: [Tutor] Need Help Modifying a wxPython GUI (scrolling
display and logging)
Date: Thu, 13 Jun 2013 00:17:44 -0400
From: Matt D
To: Dave Angel
On 06/12/2013 09:44 PM, Dave Angel wrote:
> On 06/12/2013 09:23 PM, Matt D wrote:
>>
>
On 06/12/2013 09:54 PM, Dave Angel wrote:
> On 06/12/2013 09:14 PM, Matt D wrote:
>> On 06/12/2013 09:02 PM, Dave Angel wrote:
>>> On 06/12/2013 08:46 PM, Matt D wrote:
>>>> On 06/12/2013 05:59 PM, Dave Angel wrote:
>>>>> On 06/12/2013 05:32 P
On 06/13/2013 03:39 AM, Alan Gauld wrote:
> On 13/06/13 05:24, Matt D wrote:
>
>> I already told you i found the file? why would someone else be running
>> the program?
>
> Because it does something useful?
> Most pro programmers write programs for other people to us
On 06/13/2013 08:22 AM, Dave Angel wrote:
> On 06/13/2013 12:18 AM, Matt D wrote:
>>
>>
>>
>>>
>>>
>> yes the .py file has TextCtrl fields that get there values from a
>> pickled dictionary. Another peice of the code watches a thread for the
On 06/13/2013 11:23 AM, Dave Angel wrote:
> On 06/13/2013 10:37 AM, Matt D wrote:
>> On 06/13/2013 08:22 AM, Dave Angel wrote:
>>> On 06/13/2013 12:18 AM, Matt D wrote:
>>>>
>>>>
>>>>
>>>>>
>>>>>
>>>
i am trying to figure a way to to use a list to log/print my data:
# tmplist = [time, 'nac', 'tgid', 'source', 'dest', 'algid'] is what we
want
tmplist = []
tmplist.append((str(strftime("%Y-%m-%d %H:%M:%S", localtime(
tmplist.append(field_values["nac"])
tmplis
im sorry i dont get it. there is too many brackets in this lin:
tmplist.append(field_values["nac"])
Thats where the error is but i dont see too many brackets?
On 06/14/2013 08:56 AM, Flynn, Stephen (L & P - IT) wrote:
> Not enough closing brackets on the previous line... or actually too
On 06/14/2013 10:27 AM, Alan Gauld wrote:
> On 14/06/13 14:27, Matt D wrote:
>> im sorry i dont get it. there is too many brackets in this lin:
>>
>> tmplist.append(field_values["nac"])
>>
>> Thats where the error is
>
> No, that's where
Hey,
here is a snip of my code.
#logger code--
# first new line
#self.logfile.write('\n')
# date and time
#self.logfile.write('%s,'%(str(strftime("%Y-%m-%d %H:%M:%S",
gmtime()
On 06/14/2013 03:14 PM, Dave Angel wrote:
> On 06/14/2013 10:48 AM, Matt D wrote:
>> Hey,
>> here is a snip of my code.
>>
>> #logger code--
>> # first new line
>> #self.logfile.
th trailing comma
self.logfile.write('%s,'%(str(f)))
self.logfile.write('\n')
#end logger code
In addition to not deleting the old data, it would be awesome to have
some sort of wxPython widget that would give the user the ab
> Everything Dave Angel said applies.
>
> You can sort the keys by doing and sorting the keys and then logging.
> That should ensure field order.
>
> for k in sorted(self.fields):
> v = self.fields[k]
>
>
> Also note, that unless you do self.logfile.close() it is not guaranteed
> that the d
> A common way to trigger UI actions is a button whose callback calls that.
> Or you can bind in an event hook for closing the window.
>
> in __init__ add this line -
> self.Bind(wx.EVT_CLOSE, self.onExit)
>
>
> def onExit(self, event):
>'''Run when closing'''
>self.logfile.close()
>
trying to find some way to do this.
Thanks!
--
Matt D
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 06/20/2013 08:52 AM, Alan Gauld wrote:
> On 20/06/13 12:43, Matt D wrote:
>
>> Is there a fast way test some piece of code?
>
> There are several testing frameworks for testing Python code.
> nose is one example.
> But...
>
>> look at the GUI I am making
On 06/20/2013 10:49 AM, Oscar Benjamin wrote:
> On 20 June 2013 15:32, Matt D wrote:
>> all i really want to do is test the the GUI code. i am working on a
>> 'tab' in a notebook of 7 tabs, which is itself part of a large python
>> program which gets all of its
maybe something in python like 'user_opened_file
= logfile' or 'write logfile to user_opened_file'? I am not able to
find standard way to do this.
Cheers!
--
Matt D
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
>
> I suspect that you'd get better answers on a GUI specific mailing list,
> like one for wxPython, but I note that you've already asked pretty much
> the same question there.
>
Hey guys!
Have decided that it is probably going to be better for my purposes to
simply crack open a terminal, cd int
>
> When you open a file the data should be written to that. If you want to
> move existing data from logfile.txt into user opened file then you need
> to read logfile.txt and then write it to the user opened file. To make
> your life simpler, either pass in the file path or open the file save
>
On 06/21/2013 04:44 PM, Prasad, Ramit wrote:
> Matt D wrote:
>> [Ramit P wrote:]
>>> When you open a file the data should be written to that. If you want to
>>> move existing data from logfile.txt into user opened file then you need
>>> to read logfile.txt and t
>
> You should really switch to the "with open() as f:" idiom I keep showing
> you. This will automatically close the file for you.
>
it just occured to me to do this:
def openFile(self, evt):
with wx.FileDialog(self, "Choose a file", os.getcwd(), "",
"*.tx
On 06/22/2013 03:47 AM, Alan Gauld wrote:
> On 22/06/13 02:42, Matt D wrote:
>
>> if dlg.ShowModal() == wx.ID_OK:
>> path = dlg.GetPath()
>> mypath = os.path.basename(path)
>>
I have been unable to find a way to write pickled data to text file.
My last attempt was to add the last two lines:
# the dataevent class -- stores the data that gets transmitted when the
event occurs.
#it is the data in text fields, stored in self.data as a dictionary,
which is basically a c++ m
On 06/24/2013 05:57 PM, Dave Angel wrote:
> On 06/24/2013 05:39 PM, Matt D wrote:
>>
>>> But what he's doing has nothing to do with logging. He's just using
>>> that word.
>>>
>>>
>> Right, I'm not doing a debugging thing. Ju
On 06/24/2013 06:05 PM, Matt D wrote:
> I have been unable to find a way to write pickled data to text file.
> My last attempt was to add the last two lines:
>
> # the dataevent class -- stores the data that gets transmitted when the
> event occurs.
> #it is the data in text
On 06/24/2013 07:17 PM, Alan Gauld wrote:
> On 24/06/13 23:05, Matt D wrote:
>> I have been unable to find a way to write pickled data to text file.
>
> Probably because pickled data is not plain text.
> You need to use binary mode. However...
>
>
>>
n't work, and secondly even if it did work, you will be
>> dumping a load of pickled binary data into the middle of what should be
>> a text file. That's a bad idea. And even if it succeeded, what are you
>> going to learn from seeing a line like this:
>
> I don'
>
> with open('mypicklelog.txt','ab') as log: # open in binary mode
> pickle.dump(self.data, log) # serialize data and write to file
>
> where pickle.dump(obj, file) converts `obj` to a sequence of bytes before it
> is written to `file`.
>
I put this like this:
class DataEvent(wx.PyEven
>
> Well I think self.data is some kind of container with a pickled string,
> given the code to unpickle it is:
>
Exactly! This is what the C++ file 'pickle.h' creates to send to the
Python GUI:
/**
* A pickled Python dictionary. Used to pass stuff to the UI.
*/
class pickle
{
public:
On 06/25/2013 01:54 PM, Alan Gauld wrote:
> On 25/06/13 17:32, Matt D wrote:
>
>> self.data = data
>> with open('mypicklelog.txt','ab') as log: # open in binary mode
>> pickle.dump(self.data, log) # serialize data a
>
> The real question is why do you want this pickle in a file? I am not sure
> it will be easy to pull out and reuse anyway. Given your experience level,
> I think this is a lot of work for something that you are unlikely to be able
> to easily use. I think it would be more useful to `log.wr
e, it looks like x is a list containing 'a' and [2.0, 5, [10, 20]],
hence why the len(x) gives 2.
len(x[1]) gives you 3 ( [2.0, 5, [10, 20]] )
len(x[1][2]) gives you 2 ( [10, 20] )
Matt
___
Tutor maillist - Tutor@python.org
To unsubscribe
TL:DR - Skip to "My Script: "subtrans.py"
Optional Links to (perhaps) Helpful Images:
1. The SRT download button:
http://i70.photobucket.com/albums/i82/RavingNoah/Python%20Help/tutor1_zps080f20f7.png
2. A visual comparison of my current problem (see 'Desire Versus
Reality' below):
http://i70.ph
Alan G wrote: "This is a bad idea. Instead, write your strings directly to o
o.write(s)
Print adds newlines automatically(unless you explicitly suppress
them). But printing to a file is messy compared to writing directly to
the file. (And also means you cant print debug messages while
developing
HTH,
Matt
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Hi Stephen-
The `scipy.spatial.distance` module (part of the SciPy package) contains
what you will need -- specifically, the `scipy.spatial.distance.pdist`
function, which takes a matrix of m observations in n-dimensional space,
and returns a condensed distance matrix as described in
https://docs.
On 2018-07-25 20:23, Mats Wichmann wrote:
> On 07/25/2018 05:50 PM, Jim wrote:
>> Linux mint 18 and python 3.6
>>
>> I have a list of strings that contains slightly more than a million
>> items. Each item is a string of 8 capital letters like so:
>>
>> ['MIBMMCCO', 'YOWHHOY', ...]
>>
>> I need to c
ntextmanager
def pushd(path):
old_dir = os.getcwd()
os.chdir(path)
try:
yield
finally:
os.chdir(old_dir)
```
(I tend to just copy this into projects where I need it (or write it again), as
a whole dependency for something so tiny seems like it would be overk
Hi Henrique-
It is quite easy to transfer an Anaconda installation from one machine
to the other by copying all of the files -- I have done this repeatedly
with cluster compute environments. It is sometimes nicer to run `conda
upgrade --all` in a local VM and then `rsync` the updated Anaconda
inst
101 - 162 of 162 matches
Mail list logo