Sorry Jonas,
I don't understand what you are trying to do at all.
The subject line and your code snippets don't seem
to match up.
> Subject: [Tutor] iterating in the same line
>I would check 3 words at the starting of a line
>
> s=['foo','bar','qwe']
>
> if ln.startswith(s): (this is bad)
> Also, if you have a recent version of Python (Python 2.4), the
> 'subprocess' module might be worth a look:
>
>http://www.python.org/doc/lib/module-subprocess.html
>
Is it just me or does anyone else think the new subprocess module
is making something fairly easy into something fairly comp
>Quant.append( [ db_ticker, stock_close, MTD, 0, QTD, 0, YTD, 0,
> 0, 0 ] )
>
> After Quant is created, I want to sort it by MTD. If I use a simple
> Quant.sort(), I assume its going to sort by 'db_ticker' which is not
> what I want.
you need to write your own comparison function.
Basicall
I'm trying match the lines that starting with someone variable in 's'
These sentences:
if max(map(ln.startswith,s)):
reduce(lambda m,n:m or n, map(ln.startswith, s)):
were said me in #python for this proposal.
Alan G wrote:
> Sorry Jonas,
>
> I don't understand what you are trying to do at all
> I'm trying match the lines that starting with someone variable in
> 's'
In that case this is the simplest approach:
>> for st in s:
>> if line.startswith(st): do something
That means that if you are reading the lines from a file you'd need a
neted loop:
for line in someFile:
for subst
Danny Yoo wrote:
>
> On Sat, 13 Aug 2005, Vinay Reddy wrote:
>
>
>>>Anyway, how do I call bash to run a program - e.g. slocate - from
>>>within a python program. I believe that I have to import the OS first
>>>(or do I?) and I was thinking something like:
>>>
>>>...
>>>sh slocate file_name > pyt
At 06:17 PM 8/13/2005, Jesse Lands wrote:
>I am trying to create a simple GUI that will track a network connection
>using ping. It's a starter project for me so I am sure there are other
>easier ways of doing it, but I am learning, so bare with me.
Are we taking our clothes off? Reminds me of t
> import os
> ping = os.popen('ping -c 4 10.0.8.200')
> ping_result = ping.read()
>
>
> I assume I have to use Regular Expression to read the results,
You shouldn't need to. If I call ping I get somethjing like:
$ ping www.google.com
PING www.l.google.com (66.102.7.147): 56 data bytes
64 bytes
Hello,
I am working on a way to
parse a file and wondered if there is a way to check for multiple patterns. The
reason I wonder this is because it would make everything a lot easier regarding
calculations on what words to use and so on.
What I want to do is to check
for two patterns
Quoting Alan G <[EMAIL PROTECTED]>:
> > Quant.append( [ db_ticker, stock_close, MTD, 0, QTD, 0, YTD, 0,
> > 0, 0 ] )
> > After Quant is created, I want to sort it by MTD. If I use a simple
> > Quant.sort(), I assume its going to sort by 'db_ticker' which is not
> > what I want.
> you need to wr
> The basic idea I was toying around with is to create a delete/uninstall
> program that would take the output of slocate and iterate through that
> deleting all of the files associated with the program I wanted to
> uninstall without having to do so manually. Using tar balled source code
> does no
Hi,
I tried running mplayer from a python program using the popen2 command
and read the returned output stream in non-blocking mode. But, I did
not getting any of the status messages given out by mplayer (I did get
the initial dump by mplayer).
I am using the following to read the output:
try: # g
Hey guys,
Hope you can help me on this.
I want to make a python program which opens an XML (UTF-8
encoding) and do a search & replace. It will search the Unicode and replace
them with their equivalent entity name. The program will read a look-up table
(a tab delimited text file) whi
Is it possible to create a def that not only deals cards, but also assigns
a value to each rank, except that the Jacks, Queens, and Kings all are the same
value as the 10s?
If this is possible, how should I go about doing this?
Sorry if I'm asking what for most people is a basic question,
The following code is supposed to take in a number, and print
number!:
n = int(raw_input("Number: "))x = n-1while 1:
t = n*x while x >
1: x -= 1
else: breakprint t
Why isn't it working, and how can I make it print out the correct
output?
Thanks in advance,
Nathan
--
15 matches
Mail list logo