Roman wrote:
> I am new to python.
>
> I am looking to read in a 12mb csv file, parse it, generate web pages,
> summarize on a column and make drop down bottons.
>
> Where would I be able to find sample code that does something similar
> to this?
>
> Also, I know that microsoft has put out .net be
wisted, ...
there are lots of them- search this news group, IIRC they've been
mentioned recently.
Google is your friend,
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
es not use the
module administration --"
I don't know why the globals dict you're passing in would change the
behavior though. Hopefully someone else can enlighten us both.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
/node6.html), a quick search an google can
turn up more.
(Hint: you're probably gonna want to use a while loop for the first
program and a for loop for the second.)
Hope that helps,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Nick Maclaren wrote:
...
> Create a file called '' in your current directory containing
> 'print "Oh, yeah?\n"' and then import a module that doesn't exist.
> Don't include the single quotes.
Why would you have a file named '' in
Nick Maclaren wrote:
> In article <[EMAIL PROTECTED]>,
> "Simon Forman" <[EMAIL PROTECTED]> writes:
> |> Nick Maclaren wrote:
> |> ...
> |> > Create a file called '' in your current directory containing
> |> > 'print "O
sion)
The list comprehension version:
results = [some expression for var in some_iterable if some condition]
There's more to it, but that's the basic idea.
Hope this helps,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
;1'
>
> This only gives me the index in one dimension. Is there any method by
> which I can get (1,1) as the answer.
When you sort out what you're actually trying to do, the answer to your
question may be in this thread:
http://groups.google.ca/group/comp.lang.python/browse_frm/thread/2f82408e1bcaa02e/27925504b2a4eb4a
>
> Thanks in advance.
Hope this helps,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Ritesh Raj Sarraf wrote:
> Ritesh Raj Sarraf wrote:
> > I just noticed that the args variable is holding values b and c.
> > the args variables comes from:
> > (options, args) = parser.parse_args()
> >
> > I guess I only need to figure out now is why args isn't storing
> > argument "a" also...
> >
> open but none of the widgets appear. The console gives me:
>
> AttributeError: 'NewWindow' object has no attribute 'tk'
>
> Here's my code:
Please post the entire traceback, not just the error message, thanks.
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
a wrote:
> hi simon thanks for your reply
You're most welcome
> what if i want to do this
> feed_list=[]
> feed_id=[]
> for ix in feeds_list_select:
> global feeds_list
>
Bruno Desthuilliers wrote:
> Andy Dingley <[EMAIL PROTECTED]> wrote:
> > Simon Forman wrote:
> >
> >>There's more to it, but that's the basic idea.
> >
> > This much I knew, but _why_ and _when_ would I choose to use list
> > compreh
ed...]
You're referencing self (object) instead of a Frame when creating the
Label. Change self to self.frame in both the Label and Button
initialization and it'll work.
Hope it helps,
Simon
--
http://mail.python.org/mailman/listinfo/python-list
an ask for a set of the keys easily
enough if you want it:
>>> d = dict(a=1, b=2, c=3)
>>> set(d)
set(['a', 'c', 'b'])
So, IMHO, there's not much point to having keys() return a set.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
bruce wrote:
> hi
>
> is there anyone with XPath expertise here? i'm trying to figure out if
> there's a way to use regex expressions with an xpath query? i've seen
> references to the ability to use regex and xpath/xml, but i'm not sure how
> to do it...
>
> i have a situation where i have somethi
bruce wrote:
> simon..
>
> you may not.. but lot's of people use python and xpath for html/xml
> functionality.. check google "python xpath"...
>
> later..
>
...
> > i have a situation where i have something like:
> > /html/table//[EMA
bruce wrote:
> hi...
>
> perl has the concept of "die". does python have anything similar. how can a
> python app be stopped?
>
> the docs refer to a sys.stop.. but i can't find anything else... am i
> missing something...
>
> thanks
>
> -bruce
What you want is sys.exit()
See: http://docs.python.o
; this problem is to make the variable I need global in the class that
> they are created. Does anyone have a better way in mind?
I'm not sure, but I think there's no such thing as "global to a class",
although you can make class attributes just like for objects. There
are some complexities to doing this though so you should probably stick
to instance objects rather than mucking about with class attributes..
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
://4Suite.org
> Articles: http://uche.ogbuji.net/tech/publications/
Well shut my mouth! There *is* an xml/xpath python Guru here.
*sigh* Sorry Bruce, (and everybody else on this newsgroup) I apologize
for mouthing off and not contributing to a greater signal-to-noise
ratio.
I guess that should teach me not to post so quickly when I'm in a bad
mood. I'll do better in the future.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ix.url, ix.id) tuples as
the "for index, url, id" loop iterates through them, thus saving the
overhead of a list construction and additional iteration.
I hope this makes sense and indeed answers something like your
question. ;-)
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
bruce wrote:
> hi...
>
> i'm running into a problem where i'm seeing non-ascii chars in the parsing
> i'm doing. in looking through various docs, i can't find functions to
> remove/restrict strings to valid ascii chars.
>
> i'm assuming python has something like
>
> valid_str = strip(invalid_str)
>
Grant Edwards wrote:
> On 2006-07-03, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > My problem now, is that I need to send certain binary data over a
> > socket. That is, I want to make some bytes, and stuff them in a TCP
> > packet, send them down the pipe, and then listen for a response.
...
gt; import htmlentitydefs, pprint
>>> pprint.pprint(htmlentitydefs.entitydefs)
{'AElig': 'Æ',
'Aacute': 'Á',
'Acirc': 'Â',
.
.
.
'nbsp': '\xa0',
.
.
.
etc...
HTH,
~Simon
"You keep using that word. I do not think it means what you think it
means."
-Inigo Montoya, "The Princess Bride"
--
http://mail.python.org/mailman/listinfo/python-list
bruce wrote:
> simon...
>
> the ' ' is not to be seen/viewed as text/ascii.. it's a representation
> of a hex 'u\xa0' if i recall...
Did you not see this part of the post that you're replying to?
> 'nbsp': '\xa0',
My point was
le when the data are modified, see 6)
whatever.
8) Building auxiliary data structures is fine (like a dict mapping
targets to lists they appear in, or to the sets that the function
returns ("memoizing")) but while speed is the main concern, memory
usage shouldn't be flagrant. Changing
r for the gui. I'll send it to you or post it here if you really
want. But try google first. ;-) there are certainly bound to be
better ones out there.
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Simon Forman wrote:
> I've got a function that I'd like to improve.
>
> It takes a list of lists and a "target" element, and it returns the set
> of the items in the lists that appear either before or after the target
> item. (Actually, it's a generator, an
is can be
> result[-1] -= 128
Those are two of my favorite things about python. :-)
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
nt format_exc()
Traceback (most recent call last):
File "", line 2, in ?
ZeroDivisionError: integer division or modulo by zero
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
;", line 1, in -toplevel-
f.k
AttributeError: foo instance has no attribute 'k'
>>> f.wow(23)
Traceback (most recent call last):
File "", line 1, in -toplevel-
f.wow(23)
File "", line 4, in wow
self.k += n
AttributeError: foo instance has no attribute 'k'
>>>
BTW, that's a weird place to put import statements.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
):
# do whatever here
In your case though, if I were doing this kind of thing a lot, I would
use a little helper function like the findany() function Fredrik Lundh
posted.
IMHO
if findany(a, tup):
...
is much clearer and readily understandable than mucking about with
generator comprehensions...
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
nd = ('bc', 'ab'), ('aa', 'bb')
data = 'abc'
then
data2 = 'aab' # First iteration,
data2 = 'bbb' # Second iteration replaces 'aa' even though 'aa' isn't
in original data.
Have fun,
~Simon
>
> # If f
Convert seconds since the Epoch to a time tuple expressing local
time.
When 'seconds' is not passed in, convert the current time instead.
That takes care of the "now(hours)" part of your pseudocode.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Yves Glodt wrote:
> while True:
> if now(hours) in runat:
> act()
> sleep(60)
> sleep(10)
>
Note that, if "now(hours)" *is* in runat, this loop will sleep 70
seconds, not 60. It probably doesn't matter.
--
http://mail.python.org/mailman/listinfo/python
madpython wrote:
> ...
> self.b=Tkinter.Button(root,txt="Button",command=self.doSmth).pack()
> self.l=Tkinter.Label(root,txt="default").pack()
> def doSmth(self):
> var=globals()["m"].__dict__["progLogic"].func("some
> input")
> self.l.config(txt=var)
> self.l.update_
> try:
... db = shelve.open("meh", "r")
... except Exception, err:
... E = err
...
Exception exceptions.AttributeError: "DbfilenameShelf instance has no
attribute 'writeback'" in ignored
>>> E
So:
>>> from anydbm import error
def increment(value):
map[value] += 1
And instead of,
print type1[0], type2[0], type3[0]
say,
print map[0], map[1], map[2]
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Kenneth McDonald wrote:
> Would a mailing list and newsgroup for "python contributions" be of
> interest? I currently have a module which is built on top of, and is
...
> I'd very much likes a ML/newsgroup wherein potential python contributors
> could
>
> * Post alphas/betas and seek feedback.
> *
eally do want more than "type code" (i.e. key to
your map dict) to map to the same type counter then IMHO your original
method is very apt.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Nelson wrote:
> Thanks to everyone who posted. First, I don't think my question was
> clear enough: Rob Cowie, Ant, Simon Forman, [EMAIL PROTECTED], and Jon
> Ribbens offered solutions that don't quite work as-is, because I need
> multiple values to map to a singl
e file not being found, but that is what is
> sounds like.
>
> I did a search on this on the web and got some hits, but none of them
> provide a solution to my problem.
>
> Can anyone help with this problem?
>
> Jim Anderson
Just an idea, but if you're sure that
/usr/lib/python2.4/lib-dynload/_tkinter.so exists, check it's
permissions and the permissions of /usr/lib/python2.4/lib-dynload/
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ings.Ive tried using the normal [:1],[:2],etc but I need a function
> that can do that a variable amount of times due to the varying number
> of letters in the input.
I'm sorry, but I don't know what you mean here.
>
> This would be of great help,as python is new to me.
It's a great language!
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
gt; fileitem = form["datafile"]
> print str(fileitem.filesize)
>
> -h3m4n
Try this
fileitem.seek(0, 2) # Seek to the end of the file.
filesize = fileitem.tell() # Get the position of EOF.
fileitem.seek(0) # Reset the file position to the beginning.
If the fileitem is
f I do a print out of the dictionary
> just for Character, the attributes are listed.
>
Without a sample of your code and the actual tracebacks you're getting
it is difficult to know what's going wrong.
Are you writing your class like this:
class Character:
def __init__(
placid wrote:
> quick hack
>
> def thefunc(s):
> return s = "||" + s + ">>"
>>> def thefunc(s):
return s = "||" + s + ">>"
SyntaxError: invalid syntax
--
http://mail.python.org/mailman/listinfo/python-list
a function locals()
that returns a similar dict but for locals.)
The answer to your second question is no. The inputed *name* (the
changeString() function must be passed a string, not a variable) must
be the name of an object in the global scope for the function to work.
You almost certainly want to use a function like the thefunc() function
that Jason posted.
One other thing, you could define it like so:
def thefunc(s):
return '||%s>>' % s
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
borris wrote:
> ive been trying to do a test for type with wxpython objects
>
> like
>
> passing in a wx.TextCtrl into
>
> def XXX(obj)
> if type(obj) is type(self.Button)
>
> I have to make an object self.Button to get its type.
> as I tried is type("wx.Button") which didnt work.
type("wx.Butt
[EMAIL PROTECTED] wrote:
> I reported the bug to python.org and apparently it has already been
> fixed in the latest SVN build :).
Awesome! Open Source at work! :D
--
http://mail.python.org/mailman/listinfo/python-list
/docs.python.org/lib/module-sys.html) but that
would then be called for all uncaught exceptions, even those that were
raised from modules other than your myFile.py.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
le.txt']
>
> rd
There's also os.path.sep, from the docs: "The character used by the
operating system to separate pathname components."
But a recursive function like the one Iain King posted is likely the
best way to go.
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
> Thx,
>
> Skip
I haven't used it myself, but pychecker
(http://pychecker.sourceforge.net/) is supposed to be able to perform
such stunts. From the page: "Types of problems that can be found
include: Unused globals and locals (module or variable)"
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
rence of B2 having an attribute 't', I can't
> see any other obvious differences. Is there something I am missing?
>
> TIA
> Chaz
When the developer *tells* you it won't work, that's a good indication.
:-)
You haven't missed anything: the developer
Jason Jiang wrote:
> Hi,
>
> Could someone recommend a good Python editor? Thanks.
>
> Jason
There have just been one or two long-ish threads on exactly this
question. Search the google groups version of this group for them.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
__init__(self, a, b=None):
> print self, a, b
> self.a = a
> self.b = b
>
> Item.__add__ = Add
>
> x = Item()
> y = Item()
>
> print x, y
>
> c = x+y
>
> # This time, the Add constructor gets only the first two arguments:
> "self"
ta.
What results are you getting for what input strings.
Also, if you're just trying to strip html markup to get plain text from
a file, "w3m -dump some.html" works great. ;-)
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
The self argument to __add__ ends
> up being the Add instance, not the Item instance:
No, that's *exactly* true. "x+y" does mean "x.__add__(y)" and
"x.__add__" *is* the class Add, so you're really calling "Add(y)",
nothing more nor less.
x+y =
[EMAIL PROTECTED] wrote:
> Simon Forman wrote:
>
> >
> > "Item.__add__ = Add" is a very strange thing to do, I'm not surprised
> > it didn't work.
>
> Yes it is strange.
> I also tried this even stranger thing:
>
> class Item(object):
&g
BTW, speaking of "strictness", "more stricter" is invalid English,
just "stricter" is the "correct" form. ;-)
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
heet
> will do.
Have you looked at the csv module? <http://docs.python.org/lib/module-csv.html>.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
"off-list"..) is that really how ruby
sums a list? How does that work? Doesn't the '*' mean multiply? and
what are the pipe symbols for? (Feel free to ignore these questions. I
should really go look it up myself if I'm so curious..)
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Bucco wrote:
> Simon Forman wrote:
>
> > 1) Don't use "dir", "file", and "list" as variable names, those are
> > already python built in objects (the dir() function, list type, and
> > file type, respectively.)
>
> Thanks. My
Hendrik van Rooyen wrote:
> "Simon Forman" <[EMAIL PROTECTED]> wrote:
>
> 8<-
>
> | BTW, speaking of "strictness", "more stricter" is invalid English,
> | just "stricter&qu
[EMAIL PROTECTED] wrote:
> What was i thinkinng repace * with + i was'nt thinking i origanaly
> thaught of sum of squares so i put a * insted of a +
But again, what's your question?
--
http://mail.python.org/mailman/listinfo/python-list
unexpected wrote:
> I have a program where based on a specific value from a dictionary, I
> call a different function. Currently, I've implemented a bunch of
> if..elsif statements to do this, but it's gotten to be over 30 right
> now and has gotten rather tedious. Is there a more efficient way to
t n hence
> giving information about the type of text(event).
>
> Another thign i am looking for is to have a right click on that very
> text as well
> If somebody can put some light on it, then it would be really great for
> my project.
> Thank you in advance.
What GUI system
se has this problem but it might.
There are at least three ways of dealing with this: 1) Restart the
interpreter (manually or through some IDE option), 2) call reload() on
your modules, or 3) del the modules from sys.modules before
re-importing them.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
groves wrote:
> Simon Forman wrote:
> > groves wrote:
> > > hi
> > > I am trying to get a roll over effect on my canvas.(this is a virtual
> > > program which will eventually fit into my final program)
> > >
> > > Exactly i have a text on
;IDE" and "GUI" are terms that are not
specific to python. But you still haven't answered my question? Are
you using Tkinter? wxWidgets? Gtk bindings?
Assuming that you're using Tkinter, what prevents you from using Pmw?
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
SuperHik wrote:
> groves wrote:
> > Simon Forman wrote:
> >> groves wrote:
> >>> Sorry, as I am new to python so couldn't understand what yu were
> >>> asking.
> >>> Now the problem is that i annot use pmw in my project..is thre anyo
7;s working fine. The thing is dicts do not guarantee any
particular order to their data when you access it. If you were to
delete a key-value pair and then set it again and print out your dict
again it would quite likely appear in a different order.
I've only ever skimmed DiP, but I'
clicks on it, the option COMMAND should
> invoke a function defined in some other module say Y.
>
> thanks a lot to all who will look into problem, any help would be
> appreciated.
from X import func
Then you can call func() in your module.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
a single
session, be sure to call reload() on your new (modified) file (rather
than just importing it again) otherwise you won't get the changes.
See http://docs.python.org/ref/exec.html for the exec statement and
http://docs.python.org/lib/built-in-funcs.html#l2h-59 for the reload()
function.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ion (actually int
type.. but not important here), and includes the invalid input so you
don't have to guess at it:
|>> int('wombat')
Traceback (most recent call last):
File "", line 1, in ?
int('wombat')
ValueError: invalid literal for int(): wombat
So, from what's visible in your post, it looks like int is getting
passed a bare '-', i.e. at some point you're calling int('-')...
HTH
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
e of the code
that causes the seg fault? Python standard lib is fairly robust but of
course not bullet-proof. If there's a way to make it seg fault (and
it's in the standard lib and not your C code) people will want to know.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
have to be lots
and lots of them... :-)
More information on your actual use case would be helpful in narrowing
down the best options.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
in one go:
open(orcfilename, 'w').writelines(lines)
of course stripping out your unwanted data from that last line using
find() as shown above.
I hope this helps.
Check out the docs on file objects:
http://docs.python.org/lib/bltin-file-objects.html, but like I said,
if you're dealing with html or html-like files, be sure to check out
beautifulsoup. Also, there's the elementtree package for parsing XML
that could help here too.
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Fraggle69 wrote:
> Hi,
> Does anyone have any idea of how I can use Python to get images from my
> firewire camera??
> I am using python under winXP pro
>
> Cheers
> Fraggle
Have you tried google?
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> "Simon Forman" <[EMAIL PROTECTED]> writes:
>
> > pycraze wrote:
> >> I would like to ask a question. How do one handle the exception due to
> >> Segmentation fault due to Python ? Our bit operations and arithmetic
> >
Andrew Robert wrote:
> Simon Forman wrote:
> > Paul Rubin wrote:
> >> "EP" <[EMAIL PROTECTED]> writes:
> >>> Given that I am looking for matches of all files against all other
> >>> files (of similar length) is there a better bet than usi
PetDragon wrote:
> yeah man no joy there
>
> "Simon Forman" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Fraggle69 wrote:
> >> Hi,
> >> Does anyone have any idea of how I can use Python to get images from my
> >
Andrew Robert wrote:
> Because I was lazy..
>
> The checksume_compare came from something else I wrote that had special
> logging and e-mailer calls in it.
>
> Should have ripped the reference to caller and file name out..
Aaaahh the subtle joys of cut-and-paste programming... :-D
(I've done it
Benry wrote:
> Hi guys. I hope I can discuss Twisted here. If not, direct me to the
> correct place please.
Twisted mailing list:
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
;-)
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
% i
return False
except StopIteration:
print 'File ended before FSType found.'
return False
return True
if checkfile(f):
# File passes...
pass
Be sure to close your file object when you're done with it. And you
might want fewer or different print statements.
HTH
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
rdrink wrote:
> Hey Simon, Thanks for the reply.
>
> Simon Forman wrote:
> > You must be doing something weird, that equation works for me:
> > Try posting the minimal code example that causes the error and the
> > full, exact traceback that you get.
>
> I ap
ell
> which.
The traceback tells you, unambiguously, that it's the latter, the
variable cast. That's *why* tracebacks exist, and why python prints
them by default: to tell you as much as it can about exactly what went
wrong.
>
> (BTW, as a footnote: For each of the above 'equations' the function
> equate() was called 500 times... in some cases with the list 'parts'
> equaling things like ['0',2','3','0'], so I have no reason to believe
> that the problem is with the way the list is being passed in... but I
> could be wrong)
>
> Can anyone see something I can't?
Learn to read tracebacks. They're your friends.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon wrote:
> On 2006-08-28, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Antoon Pardon wrote:
> >> There seem to be enough problems that work with ints but not with
> >> floats. In such a case enforcing that the number you work with
> >> is indeed an int seems fully appropiate.
> >
>
Antoon Pardon wrote:
> On 2006-08-28, Scott David Daniels <[EMAIL PROTECTED]> wrote:
> > Antoon Pardon wrote:
> >> On 2006-08-25, Simon Forman <[EMAIL PROTECTED]> wrote:
> >>> ...
> >>> Generally asserts should be used to "enforce" i
'll take that then as proof that it's impossible to misuse the
> function.
>
> Thanks,
> Johan
I *was* going to say that if you didn't already know the answer to that
question then your use would almost certainly be naive. But I thought
that'd be more nasty than f
> > >
> > > http://www.dexrow.com
> > >
> > > --
> > > http://mail.python.org/mailman/listinfo/python-list
>
> I need to take it between the blocks only I also need to make sure I
> only take one instrument
> defined in this example with the code instr 1 I also need the code
>
>
> > ; originally tone.orc
> > sr = 44100
> > kr = 4410
> > ksmps = 10
> > nchnls = 1
>
> regardless of what instrument I take. The function would have to
> except the instrument number as an argument
>
> http://www.dexrow.com
Using BeautifulSoup and the interactive interpreter, I figured out the
following script in about 15 minutes:
# s is a string containing the example file from above.
from BeautifulSoup import BeautifulStoneSoup
soup = BeautifulStoneSoup(s)
csin = soup.contents[0].contents[5]
lines = csin.string.splitlines()
print csin.string
It prints:
; originally tone.orc
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
instr 1
a1 oscil p4, p5, 1 ; simple oscillator
out a1
endin
and of course you could say "lines = csin.string.splitlines()" to get a
list of the lines. That doesn't take you all the way, but it's
something.
Hope that helps,
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
P://wlfraed.home.netcom.com/
> (Bestiaria Support Staff: [EMAIL PROTECTED])
> HTTP://www.bestiaria.com/
You can also pass data to a subprocess like this:
p1 = sp.Popen(["fasta34","-q","@",s],stdin=sp.PIPE, stdout=sp.PIPE)
p1.stdin.write(x)
p1.stdin.close()
But I think communicate() would be better for you in this case.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
e I once worked at had a project that included some TNEF
handling. There was one developer assigned fulltime to it. He was the
one who sat at his desk hurling curses at his workstation at the top of
his lungs, later he developed a pretty severe drinking problem.
Good luck.
HTH,
~Simon
--
ht
uld probably ask this in the psycopg mailing list:
http://lists.initd.org/mailman/listinfo/psycopg
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Hendrik van Rooyen wrote:
> "Simon Forman" <[EMAIL PROTECTED]> wrote:
>
> 8<-
>
>
> | A place I once worked at had a project that included some TNEF
> | handling. There was one developer assigned fulltime to it. He was the
>
are two recipies in the cookbook for doing this:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/202234
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66061
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
samir wrote:
> Bonan tagon!
>
> George Sakkis wrote:
>
> > It's been done; it's called "IPython":
> > http://ipython.scipy.org/doc/manual/manual.html
>
> Thank you for the link! It's just what I've needed but...
>
> Roberto Bonvallet wrote :
>
> > ...so finally you get something that is exactly lik
mt.edu/tcc/help/pubs/tkinter/text-window.html
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
jwaixs wrote:
> Thank you for all your reply and support. Neil's fits the most to me. I
> shrinked it to this function:
>
> def flatten(x):
> for i in range(len(x)):
> if isinstance(x[i], list):
> x[i:i+1] = x[i]
>
> Thank you all again. If someone could find even a cuter wa
ou want to do is
implement a less "ugly" verision of "if __name__ == '__main__':", a
quick search on google should turn up several ways.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
inking when I
reach for isspace(), it's never occurred to me to use strip() for this
task. Compare:
if offset >= len(line) or line[offset].isspace():
if offset >= len(line) or line[offset].strip():
* it's "symetrical" with the rest of the isfoo() string metho
Fredrik Lundh wrote:
> Simon Forman wrote:
>
> > I'm sorry, your post makes very little sense.
>
> you're somewhat new here, right ? ;-)
>
>
Yah, I've been posting here about three months now. Why, did I miss
something? :-)
Peace,
~Simon
--
http://
801 - 900 of 1585 matches
Mail list logo