On 04/26/2012 02:24 PM, Sean Carolan wrote:
In bash you can do this to see if a process is running:
[scarolan@kurobox:~/bin]$ kill -0 24275
[scarolan@kurobox:~/bin]$ echo $?
0
Is there a python equivalent? I tried using os.kill() but did not see
any way to capture the output.
You might
On 07/03/2010 10:25 AM, Jim Byrnes wrote:
Jeff Johnson wrote:
[snip]
http://dabodev.com/
Please check it out. And go to www.leafe.com and subscribe to the
dabo-user email list.
I would like to try out Dabo, but I don't see it in the Ubuntu
repositories and I would like to avoid using
Jim Byrnes wrote:
Running Unbuntu 9.10. The Synaptic Pkg Mgr reports python-imaging -
1.1.6-3ubuntu1 - Python Imaging Library is installed.
But trying to import PhotoImage gives these results:
from ImageTk import PhotoImage
Traceback (most recent call last):
File stdin, line 1, in
Serdar Tumgoren wrote:
Hey everyone,
Ricardo was nice enough to post his solution as a recipe on ActiveState.
For anyone interested in bookmarking it, here's the link:
http://code.activestate.com/recipes/577186-accessing-cursors-by-field-name/
Serdar
I really like Ricardo's solution
Armstrong, Richard J. wrote:
Hello all,
This is my first post to the Tutor@python.org mailto:Tutor@python.org
mailing list. I am in the process of switching from Matlab to Python and
there is one task that I am having a hard time doing and cannot find the
answer on the web. I want to write
Michael Hannon wrote:
Greetings. While looking into the use of regular expressions in Python, I
saw that it's possible to name match groups using:
(?Pname...)
and then refer to them using:
(?P=name)
I'm not sure you've got that quite right. IIUC, the (?P=name) syntax is
used
Stephen Nelson-Smith wrote:
Martin,
def __iter__(self):
while True:
for logline in self.logfile:
heappush(self.heap, (timestamp(logline), logline))
if len(self.heap) = self.jitter:
break
try:
Stephen Nelson-Smith wrote:
Nope - but I can look it up. The problem I have is that the source
logs are rotated at 0400 hrs, so I need two days of logs in order to
extract 24 hrs from to 2359 (which is the requirement). At
present, I preprocess using sort, which works fine as long as
Stephen Nelson-Smith wrote:
I think I'm having a major understanding failure.
Perhaps this will help ...
http://www.learningpython.com/2009/02/23/iterators-iterables-and-generators-oh-my/
snip
So in essence this:
logs = [ LogFile( /home/stephen/qa/ded1353/quick_log.gz, 04/Nov/2009 ),
Stephen Nelson-Smith wrote:
It's unclear from your previous posts (to me at least) -- are the
individual log files already sorted, in chronological order?
Sorry if I didn't make this clear. No they're not. They are *nearly*
sorted - ie they're out by a few seconds, every so often, but they
Luke Paireepinart wrote:
In this case you are saying is their input equal to this list with many
elements? and the answer is always going to be No because a string
won't be equal to a list unless both are empty.
I know you probably didn't mean this as it reads, or as I'm reading it,
but an
Wayne wrote:
On Fri, Sep 25, 2009 at 11:32 AM, David Eric cii...@gmail.com
mailto:cii...@gmail.com wrote:
ok this is really weird . . .
i tried running the helloworld again, and it doesnt work :/
DTm:~ davidteboul$ echo $PATH
PATH$/Library/Frameworks/
Allen Fowler wrote:
FWIW:
When using relative paths I got extra ../../ terms, so I changed
join_relative() to:
def join_relative(base, path):
return os.path.normpath(os.path.join(script_dir(base), path))
Seems to work...
Yeah, good catch ... looks great, and thanks for sharing
Allen Fowler wrote:
What is the recommended way to configure my application find the various
database and/or configuration files it needs?
Recommemded by whom? A lot depends on the OS. Apple for example have one set
of
recommendations for MacOS, Windows has another and Linux has
Allen Fowler wrote:
snip
As a follow-up question, how do give my modules stored under ./lib access to
the data in my ConfigParser object? (For instance, database connection
string, storage path, etc.)
I guess a global ConfigParser object would work, but that seems wrong.
And yet,
Allen Fowler wrote:
Something like this ...
# lib/mypaths.py
# --
import os
def script_path(base):
return os.path.realpath(os.path.abspath(base))
def script_dir(base):
return os.path.dirname(script_path(base))
def join_relative(base, path):
return
Allen Fowler wrote:
Martin Walsh mwa...@mwalsh.org
Allen Fowler wrote:
As a follow-up question, how do give my modules stored under ./lib access
to
the data in my ConfigParser object? (For instance, database connection
string,
storage path, etc.)
I guess a global ConfigParser
Martin Walsh wrote:
Elisha Rosensweig wrote:
Hi Tutors,
Im using Python 2.6.2 and the IDLE tool (also v. 2.6.2). However, when
I open the editor I cannot seem to change the directory so as to allow
for easy access to my modules. So, for example, the following occurs:
os.chdir('/Users
ayyaz wrote:
Randy Trahan wrote:
Attached is an error I cannot get to work, I was doing a print
concatenation but it won't let me get past + ibly impressive. \
(then to next line)
Also Programming Lanquage Question:
I have studied and an fairly proficient at XHTML and CSS, I tried
spir wrote:
Hello,
A foolow-up ;-) from previous question about glob.glob().
I need to 'glob' files recursively from a top dir (parameter). Tried to use
os.walk, but the structure of its return value is really unhandy for such a
use (strange, because it seems to me this precise use is
vince spicer wrote:
regex will do it
import re
line = re.sub(r\s+, \t, line)
print line
The above replaces the newline, which reminds me that even seemingly
trivial uses of 're' can become not-so-trivial in a hurry.
In [1]: import re
In [2]: line = '1 2 3 4 5\n'
In [3]:
David wrote:
David wrote:
I have a budget program I am using to learn from.
http://linuxcrazy.pastebin.com/f3b301daf
I can not figure out how to get the transaction details to return so
that it looks nice. It returns like this now.
Your transaction History is: [(1, u'Food', -100), (2,
Kent Johnson wrote:
On Fri, May 15, 2009 at 12:46 AM, R K wolf85boy2...@yahoo.com wrote:
Gurus,
I'm trying to write a fairly simple script that finds the number of hours /
minutes / seconds between now and the next Friday at 1:30AM.
I have a few little chunks of code but I can't seem to get
MK wrote:
Hi there,
i am using this code to send an cat ThisIsMyUrl with popen.
Of cos cat now waits for the CTRL+D command.
How can i send this command ?
def console_command(cmd):
print cmd
console = os.popen(cmd,r)
output = console.read()
console.close()
Nick Burgess wrote:
So far the script works fine, it avoids printing the lines i want and
I can add new domain names as needed. It looks like this:
#!/usr/bin/python
import re
outFile = open('outFile.dat', 'w')
log = file(log.dat, 'r').read().split('Source') # Set the line delimiter
for
David wrote:
Martin Walsh wrote:
... but, you don't need to use subprocess at all. How about (untested),
# grep USE /tmp/comprookie2000/emerge_info.txt |head -n1|cut -d\ -f2
infof = open('/tmp/comprookie2000/emerge_info.txt')
for line in infof:
if 'USE' in line:
USE
Sander Sweers wrote:
2009/4/29 David da...@abbottdavid.com:
Here is the whole program so far, what it does is it logs into a druple web
site and posts. I would like to make it better, as you can see I do the same
thing over and over.
http://linuxcrazy.pastebin.com/m7689c088
What you can
A.T.Hofkamp wrote:
Dinesh B Vadhia wrote:
I'm processing tens of thousands of html files and a few of them
contain mismatched tags and ElementTree throws the error:
Unexpected error opening J:/F2/663/blahblah.html: mismatched tag:
line 124, column 8
I now want to scan each file and simply
error per file per run, but
you can run it until there are no errors remaining. I hope that makes
sense.
HTH,
Marty
Message: 7
Date: Tue, 28 Apr 2009 08:54:33 -0500
From: Martin Walsh mwa...@mwalsh.org
Subject: Re
David wrote:
I am getting information from .txt files and posting them in fields on a
web site. I need to break up single strings so they are around 80
characters then a new line because when I enter the info to the form on
the website it has fields and it errors out with such a long string.
David wrote:
vince spicer wrote:
first, grabbing output from an external command try:
import commands
USE = commands.getoutput('grep USE /tmp/comprookie2000/emege_info.txt
|head -n1|cut -d\\-f2')
then you can wrap strings,
import textwrap
Lines = textwrap.wrap(USE, 80) # return a
Robert Berman wrote:
Hello Emad,
I have seriously looked at the documentation associated with pyPDF. This
seems to have the page as its smallest element of work, and what i need
is a line by line process to go from .PDF format to Text. I don't think
pyPDF will meet my needs but thank you
Kayvan Sarikhani wrote:
On Mon, Apr 20, 2009 at 1:17 PM, Martin Walsh mwa...@mwalsh.org
mailto:mwa...@mwalsh.org wrote:
from subprocess import Popen, PIPE
openssl_cmd = 'openssl s_client -ssl2 -connect somewebsitename:443'
openssl = Popen(
openssl_cmd, shell=True, stdout
Kayvan Sarikhani wrote:
Tutors,
I'm working on a script to verify whether a particular website
supports SSLv2 via the following:
--- BEGIN ---
#!/usr/bin/python
import os, re
checkssl_out = open('checkssl.txt','w')
website = 'somewebsitename'
sslv2 = 'Protocol : SSLv2'
print
Matt wrote:
Hey everyone,
I'm hoping someone here can help me solve an odd problem (bug?). I'm
having trouble with string encoding, object deletion, and the xml.etree
library. If this isn't the right list to be posting this question,
please let me know. I'm new to Python and don't know of
Hi All,
Not sure if it's common knowledge, particularly for those who didn't
make it to PyCon this year, but all of the talks were recorded and will
be available online in good time, thanks to Carl Karsten and his merry
band of A/V volunteers. I can't even begin to grasp how much work is
required
johnf wrote:
On Thursday 16 April 2009 05:04:39 pm Alan Gauld wrote:
johnf jfabi...@yolo.com wrote
I want to save the list to the field and when I retrieve the string
convert
it back to a list.
But this does NOT work.
mylist=[1,2,3,4]
mystr=str(mylist)
newlist= list(mystr)
I keep
Martin Walsh wrote:
johnf wrote:
On Thursday 16 April 2009 05:04:39 pm Alan Gauld wrote:
johnf jfabi...@yolo.com wrote
I want to save the list to the field and when I retrieve the string
convert
it back to a list.
But this does NOT work.
mylist=[1,2,3,4]
mystr=str(mylist)
newlist
Wayne Watson wrote:
If you can execute a C program compiled on a Linux with SWIG, then
that's what I'm looking for. There's really no RH dependency according
to the above posts. If it were compiled on Debian or Ubuntu, it appears
it would not make any difference. That is, one could execute a
Martin Walsh wrote:
Wayne Watson wrote:
it. It works pretty well, but puts up a a few probably top level
windows that are blank. How do I get around them, and is there anything
root = Tk()
Try adding this,
root.withdraw()
dialog = GetPassword(root)
HTH,
Marty
Wayne Watson wrote:
The program below is derived from an example in Grayson for showing how
one might a dialog for entering passwords. The structure seems just like
the original, down to the use of self, Label and Entry plus . Yet the
print here statement produces:
here None type
Wayne Watson wrote:
...
it. It works pretty well, but puts up a a few probably top level
windows that are blank. How do I get around them, and is there anything
...
root = Tk()
Try adding this,
root.withdraw()
dialog = GetPassword(root)
HTH,
Marty
greg whittier wrote:
On Thu, Mar 12, 2009 at 4:24 PM, ski nor...@khine.net wrote:
mylist = [{'a': 'x123', 'b':'12'}, {'a': 'x234', 'b': 'd33', 'c':
'a23'}, {'a': 'x234', 'c': 'XX123'} ]
where mylist has nth number of dictionaries and i want to merge the
values
of the keys that are the
mustafa akkoc wrote:
it gives this message socket error
image text
IDLE's subprocess didn't make a connection. Either IDLE can't start a
subprocess or personal firewall software is blocking the connection.
/image text
IIRC, this was once a known issue with IDLE when combined with the
windows
A.T.Hofkamp wrote:
prasad rao wrote:
helloThank you Lie and Kent.
I forgot about newline character and the fact that string can be sliced.
Thanks for your timely help
BTW I have gone through the Python library reference and find no
examples
in fileinput module.
The fileinput module
wormwood_3 wrote:
I wasn't sure if that was needed, so I took it out, sorry about that. I put
ScriptAlias /cgi-bin/ /var/www/samuelhuckins.com/cgi-bin/
in place, reloaded, and it works! I think the problem throughout was
that I was mixing up what was necessary between CGI and mod_python.
wormwood_3 wrote:
Hello all,
Hi Sam,
I'll try to give as much detail as I can, but this is a somewhat vague
problem. I have a very simple script that I would like to implement as a
CGI script, just so I can hit a URL and get some output. However, after
following a number of tutorials, I am
wormwood_3 wrote:
Thanks for all the suggestions! I tried to go through them, and will
relate what results I encountered. I changed my Apache config to:
Directory /var/www/samuelhuckins.com/cgi-bin/
AllowOverride None
Options ExecCGI
Marc Tompkins wrote:
Also - config_var_list is a tuple of lists. (I'm guessing you intended
to make it a list of lists - that's what the name indicates, after all -
but putting it between ( ) makes it a tuple.)
Sound advice, but a subtle clarification is warranted I think. It's the
comma(s)
Wayne Watson wrote:
I belong to many, many forums, Yahoo Groups, (Usenet) newsgroups, and
mail lists. Probably 100 or more. I think it's fair to say that none of
them but this one has an implicit Reply All. For newsgroups and mail
lists, I just press my Mozilla Seamonkey mailer Reply button
wesley chun wrote:
The script in the following can do the batch conversion from domain
name to IP:
This is a Python list, not Perl!
OMG! It's my mistake, sorry for this.
Lol..thats okay. Now that you are here and have seen what fun we have
writing Python code - why not join the party?
frenc1z 1z wrote:
Hello,
I would like to compare some dates (date+time really). The dates all
have the following RFC2822 format:
Eg. is d1 d2?
d1 = Tue, 13 Jan 2009 03:27:29 -0800
d2 = Tue, 13 Jan 2009 02:40:00 -0600
My thinking is that I first need to make these two dates
Jon Crump wrote:
Dear all,
I've been around and around with this and can't seem to conceptualize it
properly.
I've got a javascript object in a text file that I'd like to treat as
json so that I can import it into a python program via
simplejson.loads(); however, it's not proper json
Jon Crump wrote:
I'm still faced with the problem of the javascript months being 0
indexed. I have to add 1 to group \2 in order to get my acurate
date-string. Obviously I can't do
print jdate.sub(r'\1-\2+1-\3', s)
because the first argument to sub() is a string. How can I act on \2
before
Bryan Fodness wrote:
I would like to take a screenshot of my website without opening the
browser or importing extra packages. Is there a way to do this?
Unless you're keen on writing your own html/css/javascript/etc rendering
engine, I'm pretty sure you're going to need extra package(s), or a
Hi David,
David wrote:
Hi everyone.
Just learning :) I have one program to parse a podcast feed and put it
into a file.
Welcome!
snip
def getFeed():
url = raw_input(Please enter the feed: )
data = feedparser.parse(url)
for entry in data.entries:
sys.stdout =
David wrote:
Martin Walsh wrote:
Welcome!
thanks
welcome (uh oh, infinite loop warning)
This podcast_file.write('%s: %s' % (entry.updated, entry.link))
writes it in one very long string
Copy and paste gets me every time. Try this, and note the presence of
the newline ('\n
Omer wrote:
Hey.
I'm trying to do something I think is basic and am failing.
The goal is:
[mimicking the google urlopen syntax]
try:
from google.appengine.api.urlfetch import fetch
except:
from urllib import urlopen as fetch
How do I add this fetch the property of
phpfood wrote:
On windows XP, I'm running a program that sends TCP connections on port
5039. I'v ran wireshark to determine this. I want to create a simple
program that listens for these connections and intercepts and then turns
the data transferred into a string. From there I'd obviously like
Damon Timm wrote:
On Sat, Dec 6, 2008 at 6:25 PM, Python Nutter [EMAIL PROTECTED] wrote:
I'm on my phone so excuse the simple reply.
From what I skimmed you are wrapping shell commands which is what I do
all the time. Some hints. 1) look into popen or subprocess in place of
execute for more
Tim Michelsen wrote:
Hello,
is there any possibility in python to retrieve the system wide internet
connection settings?
I would like to access the proxy settings stored in
Internet Explorer - Extras - Options - Connection - LAN settings.
I wouldn't believe it if I didn't just see it work
Reed O'Brien wrote:
On Sep 22, 2008, at 11:50 PM, Steve Willoughby wrote:
Dinesh B Vadhia wrote:
Thanks Steve. How do you sort on the second element of each list to
get:
a' = [[42, 'fish'],
[1, 'hello']
[2, 'world']
]
something like this would do the trick:
Rilindo Foster wrote:
Scratch that, I'm a dork:
OrderDict[(o[0])] = OrderDict.get(o[0],0) + float(o[1])
http://www.faqts.com/knowledge_base/view.phtml/aid/4571/fid/541
:D
For this case you might also be interested in collections.defaultdict,
added in python 2.5 I believe.
from
Martin Walsh wrote:
Rilindo Foster wrote:
Scratch that, I'm a dork:
OrderDict[(o[0])] = OrderDict.get(o[0],0) + float(o[1])
http://www.faqts.com/knowledge_base/view.phtml/aid/4571/fid/541
:D
For this case you might also be interested in collections.defaultdict,
added in python 2.5 I
Wayne Watson wrote:
This program segment allows an invalid date to go undetected. See below.
def set_time_stamp(d1):
# /mm/dd hh:mm:ss in, vmmdd_hhmmss.27 out
formatin = '%Y/%m/%d %H:%M:%S'
d1 = d1.lstrip()
try:
date1 =
Kent Johnson wrote:
On Thu, Sep 4, 2008 at 1:00 AM, Tony Cappellini [EMAIL PROTECTED] wrote:
I was just reading the PYMOTW article on the cmd module, and trying
the examples.
http://www.doughellmann.com/PyMOTW/cmd/cmd.html
Scroll down to Auto-Completion.
Does the tab key work for anyone
Alan Gauld wrote:
Wayne Watson [EMAIL PROTECTED] wrote
BTW, how does one continue a long statement
that has, say, a long path to a file?
You can create a long string by adding the shorter string
elements :
f = open(
a:/very/long/path/name/that/needs/a/whole/line/to./itself.py,
w)
Joshua Nikkel wrote:
IDLE 1.2.2 No Subprocess
s = 'supercalifragilisticexpialidocious'
len(s)
Traceback (most recent call last):
File pyshell#1, line 1, in module
len(s)
TypeError: 'str' object is not callable
My guess would be that you've reassigned the name 'len' to
Neven Goršić wrote:
I read from one file plenty of parameters and among them one file name
of other file.
That file name is 'e:\mm tests\1. exp files\5.MOC-1012.exp' and I hold
it in variable s.
As John pointed out, if you're really reading this string from a file
(with something like
Monika Jisswel wrote:
Thanks or your replies, in fact I need my server to recieve queries from
some 40 clients, process the recieved text (some calculations) send a
response back to them, in my previouse application I used a database,
(they entered thier queries into the db my calculating
Christopher Spears wrote:
I see what you mean. I have tested it, and I have gotten a weird result:
def shorten(lst):
... lst = lst[:-1]
...
lista = [1,2,3,4]
shorten(lista)
print lista
[1, 2, 3, 4]
lista = [1,2,3,4]
lista = lista[:-1]
print lista
[1, 2, 3]
Strange...why does it work
Monika Jisswel wrote:
Would a program using a continuouse loop such as in this code take up
resources on the system if left for long period ?
import sys
while 1:
self.data = sys.stdin.readline()
self.function_1(data)
Not much, I would think, until something is
Monika Jisswel wrote:
to say the truth I never thought about additional overhead of getting
the input/output data transferred because the suprocess itself will
contain the (bash)pipe to redirect output to the next utility used not
the python subprocess.PIPE pipe so it will be like one
Dick Moores wrote:
At 11:44 AM 7/13/2008, Steve Willoughby wrote:
Dick Moores wrote:
Yes! A rule, not logic. I'm not contradicting Kent, just helping
myself understand. First the rule, then logic in the application of
the rule. And I assume the rule is there in Python because it makes
things
Dick Moores wrote:
At 07:39 PM 7/12/2008, Kent Johnson wrote:
On Sat, Jul 12, 2008 at 6:03 PM, Dick Moores [EMAIL PROTECTED] wrote:
At 01:34 PM 7/12/2008, Kent Johnson wrote:
In [2]: assert(False, Asserted false)
This is assert condition where the condition is a tuple with two
Hi Norman,
Norman Khine wrote:
for brain in brains:
x = getattr(brain, horizontal)
x = string.join(x, '' )
y = getattr(brain, vertical)
y = string.join(y, '' )
if x and y and (x, y) in table:
table[(x,
kinuthiA muchanE wrote:
Hi,
Hi Kinuthia,
I am trying to solve Problem Number 26
(http://projecteuler.net/index.php?section=problemsid=26) on project
Euler but apparently the answer I am submitting is wrong.
I am a big fan of Project Euler also. Fun stuff.
I suspect I have completely
kinuthiA muchanE wrote:
(28, '035714286')
(38, '026315789')
(81, '012345679')
For 28, the digit, in the fractional part, after 8 is 5, so 5 is
repeated and as for, 81 the next digit after 7 is 0, so again 0 occurs
twice. But for 38, the next digit after 9 is 4, and because it has NOT
Douglas Drumond wrote:
In a2() you do l1 += l2, ie, l1 = l1 + l2
A subtle clarification is warranted I think. l1 += l2 is not the same as
l1 = l1 + l2, when l1 and l2 are lists. l1 += l2 is an augmented
assignment statement, and as such will perform the operation in place if
possible, IIUC.
Jordan Greenberg wrote:
def addcommas(s): # assumes type(s)==str
b=[]
l=len(s)
for i,v in enumerate(s):
i+=1 # easier to understand w/ 1-based indexing, i think.
b.append(v)
if (l-i)%3==0 and not i==l:
b.append(',')
return ''.join(b)
John [H2O] wrote:
Hello, I would like to write a script that would have a command line option
of a pid# (known ahead of time). Then I want my script to wait to execute
until the pid is finished. How do I accomplish this?
I tried the following:
#!/usr/bin/env python
import os
import sys
Christopher Spears wrote:
I'm working on an exercise from Core Python Programming. I need to create a
function that takes a float value and returns the value as string rounded to
obtain a financial amount. Basically, the function does this:
dollarize(1234567.8901) returns- $1,234,567,89
Sean Novak wrote:
I know I'm going to feel stupid on this one..
I would normally write this in PHP like this:
for($i=1; i count($someArray); $i++)
{
print $someArray[i]
}
essentially,, I want to loop through an array skipping someArray[0]
but in python the for syntax is more like
[EMAIL PROTECTED] wrote:
. soup = BeautifulSoup(html)
. ord_tbl_price = soup.find('td', {'class': 'order_tbl_price'})
. ord_tbl_price
td class=order_tbl_pricespan class=order_table_price_small
/span $32.66/td
So now, how do I reduce the price by 15% and write it back to the
document?
Not
Nathan McBride wrote:
Yup, I got some help in IRC. What I ended up doing was using regex to
pull out each /dev/loopX. Then
took the X and fed it to max which in turn gave me the highest numbered
loop device in use. After which I
then just added 1 to X and added it to the end of /dev/loop_.
James Duffy wrote:
I have a problem w/ a file transfer receiver. They way it works is it
binds a port for incoming transfer , when the file transfer is complete.
It closes the connection and the socket, then loops back and restarts
the bind and listen. I have it set so that the socket is
Monika Jisswel wrote:
Hi,
can i stop urllib2.urlopen() from following redirects automatically ?
It doesn't answer your question directly, but if you care more about the
initial request/response than the content at the other end of a redirect
-- you can use httplib. It might look something
Dick Moores wrote:
See http://blog.doughellmann.com/2007/10/pymotw-difflib.html
And my try with the Differ example,
http://py77.python.pastebin.com/f41ec1ae8, which also shows the error,
E:\Python25\pythonw.exe -u E:\PythonWork\demo_pymotw-difflib.py
Traceback (most recent call last):
Hi Nathan,
Nathan McBride wrote:
Yup I use the pexpect module for a lot however couldn't get 'pexpect.run' to
work with mysqldump piping to gzip
Just to hazard a guess -- when you want to pipe commands with pexpect
you have to spawn ('run', it seems, would work the same way) the shell
Ravi Kondamuru wrote:
Hi,
I have a log file that prints the date and time in the following format:
Mon Feb 11 01:34:52 CST 2008
I am expecting multiple timezone entries (eg: PST, PDT and GMT) on the
system running in America/Los Angeles time zone.
I am looking for a way to internally store
János Juhász wrote:
It is nice place to use a generator:
def pairs(sliceit):
streamlist = list(sliceit)
streamlist.reverse()
while streamlist:
pair = streamlist.pop()
try:pair += streamlist.pop()
except: pass
yield pair
## Probably it
János Juhász wrote:
Dear Marty,
Hi Janos,
... Or, by extending Alan's solution ...
def splitStringByN(s, n):
for m in range(0, len(s), n):
yield s[m:m+n]
k = 'abcdefghi'
list(splitStringByN(k, 2))
It seems to be the most readable solution for me.
For completeness, one
Ricardo Aráoz wrote:
Emil wrote:
hey
I want to be capable of converting a string into a list where all the items,
in the list, have a fixed length not equal to 1 e.g i have k = 'abcdefgh'
and I want the fixed length for all the the items to be 2 then the list
would look like ['ab',
Ricardo Aráoz wrote:
Martin Walsh wrote:
Hi Marty, thanks for your help.
I've tried your suggestions but they don't seem to work for me. In W's
system window I can do :
C:/ S:\FirefoxPortable\FirefoxPortable.exe http://www.google.com
and it will open my browser ok. But no matter what I try
Ricardo Aráoz wrote:
Hi, I've checked webbrowser module and so far I find no way of selecting
a browser other than the default one. Say I want certain places opened
with IE and others with Mozilla, and I don't want to mess with the
user's setting of the default browser. Any tips?
TIA
I think
Trey Keown wrote:
Hey all,
I just got a brand new T-Mobile Wing, and, as you might guess, I want to
install python on it. Well, I tried both the pythonce main build (with the
.exe), and the build for the smartphone (also used .exe), but once I
downloaded them, when I tried to run them, a
John wrote:
Hello,
Hi John,
I didn't see a response to your question, so I'll make an attempt ...
I've written a script which conducts several subprocess calls and then
ultimately calls a shell script which runs even more programs... my
script is using subprocess to execute a few sed
Alan Gauld wrote:
Tony Cappellini [EMAIL PROTECTED] wrote
I have to switch between 2.3 and 2.5, so to make it easy, I use an
environment variable called CURRENT_PYTHON.
(someone on this list or the wxPython list told me I should NOT use
PYTHONPATH and modify it the way I am using
Tony Cappellini wrote:
Martin Walsh mwalsh at groktech.org
Sun Nov 11 06:13:10 CET 2007
That is odd.
Try using the full path to python, just to be sure: c:\python25\python
script.py -- do you get the same behavior?
This works just fine- I would expect it to.
Actually, I would have
Tony Cappellini wrote:
What do you get if you print sys.path from
the interpreter?
I've printed out sys.path from inside the script as well,
and all references to Python25 are replaced with Python23
FWIW- This isn't a problem unique to this script.
I've just printed out sys.path from
1 - 100 of 128 matches
Mail list logo