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
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
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
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.
HTH,
Matt
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
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
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
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 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
>
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
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
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
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
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
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
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
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
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
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
>
> 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
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
>
> 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:
>
> 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
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'
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...
>
>
>>
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 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
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/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)
>>
>
> 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/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
>
> 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
>
>
> 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
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
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
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
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
> 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()
>
> 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
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
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.
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 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
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
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
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:
>>>>
>>>>
>>>>
>>>>>
>>>>>
>>>
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 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/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
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:
>>
>
> 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
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
>
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
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
[]
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
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
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
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
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
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
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:
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
#x27;ve been able to get
what I need by just defining __setattr__ in both classes. Whether I did
that correctly is a story for another thread ...
matt
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
y.
HTH,
Matt
Robert Jackiewicz wrote:
On Wed, 13 Oct 2010 14:16:21 -0600, Ara Kooser wrote:
Hello all,
I am working on merging two text files with fields separated by
commas.
The files are in this format:
File ONE:
*Species, Protein ID, E value, Length* Streptomyces sp. AA4,
ZP_
;http://www.instamapper.com/fe?page=track&device_key=abc
')
print resp.read()
resp.close()
The ValueError is raised each time. If I remove this and read the response,
the page thinks I have disabled cookies and blocks access. Why isn't cj
grabbing the InstaMapper cookie?
Are there
On Tue, Oct 20, 2009 at 07:53:17AM -0700, Steve Willoughby wrote:
> On Tue, Oct 20, 2009 at 10:44:16AM -0400, Matt Herzog wrote:
> > Yes, thanks. What failed was the invocation of PIPE. Apparently I had to
> > explicitly import PIPE from subprocess or python had no clue as to wha
On Tue, Oct 20, 2009 at 02:49:53PM +, Tiago Saboga wrote:
> On Tue, Oct 20, 2009 at 2:44 PM, Matt Herzog wrote:
> > Yes, thanks. What failed was the invocation of PIPE. Apparently I had to
> > explicitly import PIPE from subprocess or python had no clue as to what
> > P
On Tue, Oct 20, 2009 at 08:29:59AM +0100, Alan Gauld wrote:
> "Matt Herzog" wrote
>
> >Anyway, I'd like a hint as to how I could convert this:
> >
> >ifcfg_lines = os.popen("/sbin/ifconfig fxp0").readlines()
> >x = string.split(ifcfg_lines[3
On Mon, Oct 19, 2009 at 07:51:06PM -0400, Matt Herzog wrote:
> On Mon, Oct 19, 2009 at 08:07:47PM +0100, Alan Gauld wrote:
> >
> > "Matt Herzog" wrote
> >
> > >remembered that strings are immutable.
> > >So how was I able to change the
On Mon, Oct 19, 2009 at 08:07:47PM +0100, Alan Gauld wrote:
>
> "Matt Herzog" wrote
>
> >remembered that strings are immutable.
> >So how was I able to change the strings for my dotted quad?
>
> You didn't.
>
> >LASTKNOWN = '173.48.204
Hi All.
The below script seems to work well enough to use but I'm wondering if I'm
doing the file edit stuff in a "kosher" manner. I was just reading the Lutz
O'Reilly "Learning" book and remembered that strings are immutable. So how was
I able to change the strings for my dotted quad? I did no
On Mon, Jul 20, 2009 at 05:26:09PM -0500, Wayne wrote:
> On Mon, Jul 20, 2009 at 5:18 PM, Matt Herzog wrote:
>
> > On Mon, Jul 20, 2009 at 11:57:57PM +0200, Sander Sweers wrote:
> > > Please reply to the list.
> > >
> > > 2009/7/20 Matt Herzog :
> >
On Mon, Jul 20, 2009 at 11:57:57PM +0200, Sander Sweers wrote:
> Please reply to the list.
>
> 2009/7/20 Matt Herzog :
> > Yeah. I have no idea if I am able to do this. The jail makes it ambiguous.
>
> There is no difference, the jail just moves the root directory as
A user of the paramiko mailing list said,
"Paramiko has an SFTPClient class and an SSHClient that can be used to
transfer files, why complicate it by using a Transport directly. The
easiest thing is to open an SSHClient:
If I change
remotepath = 'datestr'
to
remotepath = datestr
I get:
sftp.get(remotepath, localpath)
File "build/bdist.linux-x86_64/egg/paramiko/sftp_client.py", line 587, in get
IOError: [Errno 21] Is a directory: '/tmp/testor/'
So remotepath is really more like a path + filname.
So I ne
On Mon, Jul 20, 2009 at 11:02:52PM +0200, Sander Sweers wrote:
> 2009/7/20 Matt Herzog :
> > Traceback (most recent call last):
> > ??File "./scpgetter.py", line 20, in ?
> > ?? ?? ??sftp.get(remotepath, localpath)
> > ?? ?? ?? ??File "build/bdis
On Mon, Jul 20, 2009 at 10:22:37PM +0200, Sander Sweers wrote:
> I do not know paramiko but looking over the client documentations...
>
> 2009/7/20 Matt Herzog :
> > if __name__ == "__main__":
> >t = paramiko.Transport((hostname, port))
> >t.connect
g is missing.
Traceback (most recent call last):
File "./scpgetter.py", line 20, in ?
sftp(remotepath,localpath)
TypeError: 'SFTPClient' object is not callable
I tried using the paramiko.SFTP.get method too. Failed.
-- Matt H
>
> Kent
--
I fear you speak u
Hello All.
I need to use paramiko to sftp get a single file from a remote server.
The remote file's base name will be today's date (%Y%m%d) dot tab.
I need help joining the today with the .tab extension. Do I need globbing?
example: 20090716.tab
#!/usr/bin/env python
import paramiko
import glob
ectory, it'll move the
file there."
Example: If I use: "os.rename(src, dst)" where I had "os.system("mv"+ " " + src
+ " " + dst)" no files are coppied.
os.renames happily renames the source directory, but that's not what I want.
Should be simple, right? Not for me, heh.
def schmove(src,dst):
... src = '/home/datasvcs/PIG/cjomeda_exp/'
... dst = '/home/datasvcs/PIG/cjomeda_exp_archive/'
... listOfFiles = os.listdir(src)
... for filez in listOfFiles:
... os.system("mv"+ " " + src
On Sun, May 10, 2009 at 12:53:49AM +0100, Alan Gauld wrote:
> Have you used normal ftp in its command line version?
> The put command specifies the location on the remote machine
> where you want to store the files. This is normal ftp behaviour.
The server supports only sftp. Yeah, I could turn o
Hello again.
This code comes straight from the http://oreilly.com/catalog/9780596515829/
book.
The only actual code I changed was s/get/put on the second to last line. The
author says I ought to be able to do this and have it Just Work. There are
several things I don't understand. Would be nic
On Fri, May 08, 2009 at 02:30:22PM -0400, Kent Johnson wrote:
> On Fri, May 8, 2009 at 1:04 PM, Matt Herzog wrote:
> > Hey All.
> >
> > All I need to do in this script is scp or sftp a bunch of files to a remote
> > server. This script will run from a cron job event
Hey All.
All I need to do in this script is scp or sftp a bunch of files to a remote
server. This script will run from a cron job eventually.
For whatever reason, paramiko can't cope with a list.
---
AttributeError
ase of the print
function setup that you suggested with write? Or could I somehow use
the print function itself to write to the file (rather than just
output to my shell/prompt)?
Thanks!
Quoting W W :
On Fri, Apr 24, 2009 at 10:57 PM, Matt Domeier wrote:
Hello,
I have a series of lists t
Hello,
I have a series of lists that I need to output into files with a
specific format. Specifically, I need to have line breaks after each
entry of the list, and I need to do away with the ['..'] that
accompany the data after I transform the list into a string. Can I
simply append a '\n
I'm trying to calculate the derivative of a function in Python like so:
def D5(func,h=1e-5):
""' Return derivative of function func'''
def df(x):return (func(x+h)-func(x))/h
df.__name__ = func.__name__ + '_dx'
return df
However, I run into the problem of limited float precisio
efficient.
On Mon, Apr 20, 2009 at 1:27 PM, Alan Gauld wrote:
> "Matt" > wrote
>
> Let's say I want to run func 10 times Is there a more pythonic way to do
>> it
>> than this:
>> for i in xrange(10):
>> func()
>>
>
> Yes, use r
xml.etree.ElementTree. This makes no sense to me, since it works fine
normally.
Thank you very much. Any and all help or pointers are appreciated.
~Matt
db.py ###
from xml.etree import ElementTree as ET
import os
class Database(object):
def __init__(self, path):
self.__d
Hey everyone,
First post to this list. I hope I'm doing it right.
Let's say I want to run func 10 times Is there a more pythonic way to do it
than this:
for i in xrange(10):
func()
Thanks.
___
Tutor maillist - Tutor@python.org
http://mail.python.org
> Do you want to use optparse, or get the command line arguments yourself?
> It seems the pattern string will be the first arg, will it?
Again I am confused. I assumed that optparse was the best way to pass in
arguments (such as filenames) from the command line. Like so:
./script.py -x r
On Wed, Dec 24, 2008 at 01:12:55AM -, Alan Gauld wrote:
>
> "Kent Johnson" wrote
>
> >> for filename in os.listdir(directory):
> >> result = re.match(s, filename)
> >> print result
> >
> >You never open and read the files. You are searching for the pattern
> >in the filenam
Hi All.
I want to write a script that will emulate grep to some extent. This is just an
exercise for me. I want to run the script like this:
./pythongrep directory searchstring
Just like grep, I want it to print: filename, instance_of_match
As of now, the script can't find anything I tell it t
- Forwarded message from Tiago Katcipis -
i forgot, this might help you
http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files
I can't help wondering how to do this in python:
perl -wnl -e '/string/ and print;' filename(s)
Not that I want to forget the pre
o square root a number less than 0.
Matt
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Matt Smith wrote:
> import sys, pygame, math
>
> ...
>
> if ypos >= 384 and velocity > 0:
> impactvel = sqrt(velocity ** 2 + (2 * gravity * (ypos - 384 *
> 160)))
>
> ...
>
>
> Traceback (most recent call last):
> File "",
velocity > 0:
impactvel = sqrt(velocity ** 2 + (2 * gravity * (ypos - 384 * 160)))
...
Traceback (most recent call last):
File "", line 32, in
ValueError: math domain error
This one has me stumped as the usage of the module looks straight forward from
the documentation.
Hi there,
I am currently working on a noughts and crosses program to try and teach
myself some very simple AI programming and also to start to use OOP in
Python.
I am currently writing the framework for the game so I can then write a
number of functions or a class to deal with the strategy sid
Check out geany. It's fairly simple but I've found it very neat and simple.
http://geany.uvena.de/
On 6/11/07, scott <[EMAIL PROTECTED]> wrote:
Could someone suggest a few good IDE's for me to look at. I would
need
a IDE that haves syntax highlighting and I also really like type
compl
1 - 100 of 162 matches
Mail list logo