ut which question leads to which next question.
This way also makes for an interesting talking point about separating
data and code, especially given the multiple if statements issue.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
t;/a/b.htm", "/a/c.htm"]
page = "\n"
fmt = "var frames=Array({});\n"
page += fmt.format(",".join(map(lambda x:'"'+x+'"', files)))
page += "\n"
print page
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
essage, it's going to nuke Beijing and Moscow .
(I really really really hope that this is indeed fiction!)
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
and the intent of the question you meant to ask, you
might find that the following code does something interesting:
x = 9876543210
y = []
while x > 0:
y.append(x % 10)
x = int(x / 10)
y = list(reversed(y))
print y
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org
o convert km to miles
def convert_km_mi(km):
return convert_float_a_b(km, 0.6214)
# now call main to kick it all off
main()
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 29 Sep 2015 10:16:04 +0530, Laxmikant Chitare wrote:
> Is there any similar elegant way to check if a value is out of certain
> range?
What about:
if not (0 < x < 10):
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, 30 Sep 2015 23:06:13 +0530, Rusiri Jayalath wrote:
> Error code 0x80070570 appears when installing python 3.5.0 (32-bit)
> setup for my windows 8.1 system. Please help me to solve this problem.
This seems to be a windows error, not a python issue. Try google.
--
Denis M
) alice tom (1, 4) peter (2) andrew(3,4) janet( 7,6 ) james
( 7 ) mike ( 9 )"
d = {'mike': (9, 0), 'janet': (7, 6), 'james': (7, 0), 'jim': (1, 0),
'andrew': (3, 4), 'alice': (0, 0), 'tom': (1, 4), 'peter': (2,
= data_tuple
Please don't top post.
What happens if there's more whitespace than you allow for preceding a
'(' or following a ',', or if there's whitespace following '('?
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
(a list because I want to be able to
modify it)
setting d[word][n] = int(num) for each num element (numpatt.match(thing))
with n depending on whether it was the first or second num following the
previous word
then:
d = {x:tuple(d[x]) for x in d}
to convert the lists in the new dic to tuples
On Wed, 30 Sep 2015 23:30:47 +, Denis McMahon wrote:
> On Wed, 30 Sep 2015 11:34:04 -0700, massi_srb wrote:
>
>> firstly the description of my problem. I have a string in the following
>> form: .
>
> The way I solved this was to:
>
> 1) replace all the
u have given,
I have waved my magic wand. If this didn't work, the information you
supplied was insufficient.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
unB(x, y):
return (x-y)
# this line
# print(funA(4,funB(2,3), funB(3,2)))
# can be written as the following 4 lines:
a = funB(2, 3) # 2 - 3 -> -1
b = funB(3, 2) # 3 - 2 -> 1
c = funA(4, a, b) # (4 + -1) * 1 -> 3
print(c) # 3
--
Denis McMahon, denismfmcma...@gmail.com
--
https
i]:
if len(row[i]) == 0:
flags[i] = True
else:
blanks = True
if not blanks:
break
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
wand. It should work now. If it still doesn't work, please provide more
details about the problem.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
t; before you ask questions about it, then that would be even better.
> Knowing what piece of code would also help us to help you. As a starter
> here is a small piece of code.
>
> a = 1
>
> Is that adequate?
If not, perhaps:
b = [c for c in range(20)]
d = {e:b for e in
stop or end to exit: ")
print("you entered: ", x)
if x in ["stop","quit","end"]:
stop = True
print("Finished now")
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
e all the permissions needed to write to the directories you're
asking it to put files in?
Did you run the installation process with those permissions?
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
7;, 'c', 'd', 'e'], 'i':
['g', 'h'], 'h': ['g', 'i'], 'm': ['l', 'n', 'o'], 'l': ['m', 'n', 'o'],
'o': ['l', 'm', 'n'], 'n': ['l', 'm', 'o']}
The second variant using, m = deepcopy(l).remove(i) fails thus:
{'a': None, 'c': None, 'b': None, 'e': None, 'd': None, 'g': None, 'f':
None, 'i': None, 'h': None, 'm': None, 'l': None, 'o': None, 'n': None}
I'm not sure I understand why after m = deepcopy(l); m.remove(i); m is a
different value to that which it as after m = deepcopy(l).remove(i).
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, 18 Oct 2015 20:38:26 +, Denis McMahon wrote:
> On Sun, 18 Oct 2015 03:17:18 -0700, Beppe wrote:
>
>> hi to everybody, I must turn a tuple of lists into a dictionary.
>
> I went down a different path to Peter, and discovered something
> perplexing:
I just r
if c2:
if c3:
# c1 && c2 && c3
# 4 second open
else:
# c1 && c2
# 3 second open
else:
# only c1
# 2 second open
Each condition only gets evaluated once.
--
Denis McMahon, denismfmcma.
On Wed, 21 Oct 2015 20:07:21 +, Grant Edwards wrote:
> On 2015-10-21, Denis McMahon wrote:
>> On Wed, 21 Oct 2015 10:31:04 -0700, bigred04bd3 wrote:
>>
>>> So here what I have, I have a 3 IF's within the same level. If one IF
>>> is satisfied, I
er()
for i in range(100):
x = "test *"[-1] == "*"
elapsed = timeit.default_timer() - start_time
print "char compare, true", elapsed
RESULTS:
re, false 2.4701731205
re, true 2.42048001289
compiled re, false 0.875837087631
compiled re, true 0.876382112503
char comp
er, I
> can read the messages from there from time to time.
Read more carefully!
The earlier poster suggested options that would work if you set up your
own server, or already had one.
You can poll your gmail server using pop3 as the earlier reply suggested.
You may need to configure some op
rage of', students, 'scores is', sumscore / students
It was trivial to generate:
Sum of 50 scores is 3028
Average of 50 scores is 60
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
e, the execution time varies with the size of the datafiles.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
provide executable tools at the OS level which are more efficient than
anything you will write in a scripting language.
Lesson 1 of computing. Use the right tool for the job. Writing a new
program is not always the right tool.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.or
g about supposed "real names".
TPEL has been trolling html, php and javascript newsgroups for years,
recently he seems to have discovered python newsgroups. :(
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
for k in keybits:
del row[k]
plotdata[key] = row
This generates a dictionary (plotdata) keyed by the key tuples where the
value for each key is a dictionary of 0:0n : value
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
ass_='lister-list'):
for link in item.find_all('a'):
# write link to file
# close file
Alternatively, use the with form:
with open("blah","wb") as text_file:
for item in soup.find_all(class_='lister-list'):
for link in item
t; ...
> ('', 'who', '', None)
> (' likes ', 'what', '', None)
Or even:
>>> s = "{who} likes {what}"
>>> d = {'who': "Adam", 'what': "ants"}
>>> keys = [
for anything useful, because it will just use all the
memory up. So perhaps you need to express your question in a better
manner.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
n that
> list and returns Jordan's results i.e. (12) ?
You open a web browser and google for "python dictionary"
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
": 13}
> }
>
> How do you get gengyang's maths scores ?
I refer to my previous answer. Open a web browser and google "python
dictionary"
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, 07 Jun 2014 01:50:50 +1000, Chris Angelico wrote:
> Yes and no. "ASCII" means two things:
ASCII means: American Standard Code for Information Interchange aka ASA
Standard X3.4-1963
> into the lowest seven bits of a byte, with the high byte left clear.
high BIT left c
>>> x['2014-06-05']
array([0, 1])
>>> x
{'2014-06-05': array([0, 1])}
>>> x['2014-06-05'][0]
0
>>> x['2014-06-05'][1]
1
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
prettify() )
fp.close
n += 1
will give you:
scraped/body0.htm
scraped/body1.htm
scraped/body2.htm
for as many urls as you have in your url list. (make sure the target
directory exists!)
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
0 )
print "hello {:0>5d} world".format( 500 )
print "hello {:0>5d} world".format( 5000 )
print "hello {:0>5d} world".format( 5 )
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 01 Jul 2014 03:51:31 -0700, Jaydeep Patil wrote:
> How to convert excel range into python list or tuple?
> show me example
http://lmgtfy.com/?q=convert+excel+range+into+python+list+or+tuple
This is an example of how to google a programming question. Learn from it!
--
Denis M
arch for solutions to his
problem. If he can't be bothered to try and solve it himslef, I'm nopt
going to write his code for him.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, 04 Jul 2014 14:27:12 +0200, Florian Lindner wrote:
> self.regexps = [r"it (?P\d+) .* dt complete yes |
> write-iteration-checkpoint |",
> r"it (?P\d+) read ahead"
My first thought is what is the effect of '|' as the last char
you for your time.
Write your code in a file and run them from your command line, instead of
entering your programs directly into the interpreter.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
have a string containing your filename, you might use:
fp = open( fn, "w" )
fp.write( data )
fp.close()
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
statements as
follows, does the problem persist?
for rdiff in range( 450, 600, 100 ):
if rdiff >=500:
for i in range( 1, 3 ):
print rdiff, i
elif rdiff >=410:
for i in range( 1, 3 ):
print i, ridff
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
concerned, and the text that's being loaded.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
to help you defeat captchas?
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
be thankful that he's so dumb.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 12 Aug 2014 00:33:11 -0700, Rustom Mody wrote:
> Ive been asked to formulate a python course for financial services folk.
I wouldn't worry too much about c or c++ interfacing paradigms.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 12 Aug 2014 10:48:14 -0700, Rustom Mody wrote:
> However those folks have thousands of lines of C/C++ which they are
> porting to python.
That begs the question: Why?
Seriously, I'd like to know what benefits they expect to achieve by doing
so.
--
Denis McMahon,
:
print cell
print "+"
else:
print "HTTP Status", r.status_code
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
ambot, in fact if anything it may damage
it. I agree that there are more reasons not to use captcha these days
than there are to use them, however I still don't advocate helping spambot
bastards defeat them.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
g such requirements.
Yes, we understand that your spambot requires to decode captcha. We were
just telling you in fairly polite terms that you should fuck off because
we have no wish to help you. We tried polite, it didn't work, now I'm
trying robustness and profanity.
--
Denis McMa
s]
print num
Fill in the rest of the months dictionary yourself, it shouldn't be too
hard.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
rror: 'z' is a bad directive in format '%a, %d %b %Y %H:%M:%S %z'
> datetime.datetime(2014, 8, 9, 7, 36, 46,
> tzinfo=datetime.timezone(datetime.timedelta(-1, 61200)))
And this:
AttributeError: 'module' object has no attribute 'timezone'
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
;, 'EEST', 'FET', 'IDT', 'IOT', 'SYOT'],
210: ['IRST'],
240: ['AMT', 'AZT', 'GET', 'GST', 'MSK', 'MUT', 'RET', 'SAMT', 'SCT',
'VOLT'],
270: ['AFT', 'IRDT'],
300: ['AMST', 'HMT', 'MAWT', 'MVT', 'ORAT', 'PKT', 'TFT', 'TJT', 'TMT',
'UZT'],
330: ['IST', 'SLST'],
345: ['NPT'],
360: ['BIOT', 'BST', 'BTT', 'KGT', 'VOST', 'YEKT'],
390: ['CCT', 'MMT', 'MST'],
420: ['CXT', 'DAVT', 'HOVT', 'ICT', 'KRAT', 'OMST', 'THA', 'WIT'],
480: ['ACT', 'AWST', 'BDT', 'CHOT', 'CIT', 'CST', 'CT', 'HKT', 'MST',
'MYT', 'PST', 'SGT', 'SST', 'ULAT', 'WST'],
525: ['CWST'],
540: ['AWDT', 'EIT', 'IRKT', 'JST', 'KST', 'TLT'],
570: ['ACST', 'CST'],
600: ['AEST', 'CHUT', 'DDUT', 'EST', 'PGT', 'VLAT', 'YAKT'],
630: ['ACDT', 'CST', 'LHST'],
660: ['AEDT', 'KOST', 'LHST', 'MIST', 'NCT', 'PONT', 'SAKT', 'SBT',
'VUT'],
690: ['NFT'],
720: ['FJT', 'GILT', 'MAGT', 'MHT', 'NZST', 'PETT', 'TVT', 'WAKT'],
765: ['CHAST']
780: ['NZDT', 'PHOT', 'TKT', 'TOT'],
825: ['CHADT'],
840: ['LINT'],
}
I've patched my 2.7 to set a tz string of "UTC[+-]" from the [+-]
%z value.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, 15 Aug 2014 07:39:23 +, Denis McMahon wrote:
> I've patched my 2.7 to set a tz string of "UTC[+-]" from the
> [+-] %z value.
... but that doesn't do much, because time.struct_time in 2.7 doesn't
recognise anything that strptime passes in as
9 Aug 2014 07:36:46 +
2014-08-09 07:36:46+00:00
2014-08-09 07:36:46+00:00
UTC -7 as UTC:
2014-08-09 14:36:46+00:00
2014-08-09 14:36:46+00:00
UTC +7 as UTC:
2014-08-09 00:36:46+00:00
2014-08-09 00:36:46+00:00
UTC as UTC:
2014-08-09 07:36:46+00:00
2014-08-09 07:36:46+00:00
"""
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
.6.3]'
for Python 3.2. Again, I stress, we need to know what version of python
you are using to help you!
Did you run the code I posted? Did you get the same output as me? If you
didn't, what was different. If you did get the same output, what do you
think is wrong with it?
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, 15 Aug 2014 09:23:02 -0600, Ian Kelly wrote:
> On Fri, Aug 15, 2014 at 1:39 AM, Denis McMahon
> wrote:
>> On Fri, 15 Aug 2014 10:24:47 +0800, luofeiyu wrote:
>>
>> On further inspection, it seems that strptime() in 2.7 doesn't handle
>> %z at all. I
s in some strings, deleted extra spaces
in some strings, deleted extraneous information after the tz offset in
some strings. When feeding strings to a parsing function such as strptime
() it is critically important that the format specifier matches the input
data.
--
Denis McMahon, denismfmcma...@gmail
passing through a
python error message.
Is this the complete error message?
What happens when you try and access http://[server]/cgi-data/index.html
directly in a web browser? You may need to copy the file to a different
directory to do this depending on the apache configuration.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
ropriate) before calling the python script.
I believe that the following line in your httpd.conf may have the
required effect.
SetEnv PYTHONIOENCODING utf-8
Of course, if the file is not encoded as utf-8, but rather something
else, then use that as the encoding in the above suggestions. If th
s always noon, and midnight, and
everything else at the poles, I just have to live with that.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
al time terms,
so does he want West Urumqi time, Central Urumqi time or East Urumqi time?
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
I don't consider it particularly elegant. :(
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
our code.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
tries = tries + 1
print "it took " + tries + " attempts to guess " + choice
This simplification doesn't take the calculation of ranges into account,
but that's part of "guess the/another answer".
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, 23 Aug 2014 11:56:29 -0700, Ed Joz wrote:
> Please suggest a sample python code.
while program result not correct:
fix program
Note - we are not here to write your code for you, but we will try and
help you develop your own code to do what you want.
--
Denis McMa
the filename to generate the subject
eg (assuming suitable imports etc) and the message is in a text file
called message.txt:
msgfile = "message.txt"
fp = open( msgfile, "r" )
msg = MIMEText(fp.read())
fp.close()
msg['Subject'] = 'The contents of %s'
ine 7, in
> print (steve[x])
> IndexError: list index out of range
x is the value, not the index
Try:
steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for x in steve:
print (x)
or if you want to use the index:
for x in range(len(steve)):
print (steve[x])
--
Denis McMaho
On Thu, 04 Sep 2014 00:39:07 +0100, MRAB wrote:
> It would add tuples, delimited by (...), which are not used otherwise
> (no expressions):
I guess <> and () are both unused as delims by json at present.
I like the idea of other key types than string.
--
Denis McMahon,
On Wed, 03 Sep 2014 07:16:34 +, Steven D'Aprano wrote:
> Who uses + for disjunction (∨ OR) and concatenation for conjunction (∧
> AND)? That's crazy notation.
The way I was taught it in the mid 1980s, a.b === a and b, a+b === a or b.
--
Denis McMahon, denismfmcma...@gma
On Thu, 04 Sep 2014 21:42:56 +1000, Chris Angelico wrote:
> On Thu, Sep 4, 2014 at 9:17 PM, Denis McMahon
> wrote:
>> On Wed, 03 Sep 2014 07:16:34 +, Steven D'Aprano wrote:
>>
>>> Who uses + for disjunction (∨ OR) and concatenation for conjunction (∧
or of n greater than n/2 is n, and 2 is probably the first value you
tested. This can speed things up.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
You are trying to reference more elements than your list contains.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
?q=best+face+detection+algorithm+python
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
t;>
> [code]
Although your solution will produce valid html, it doesn't produce the
specified output. ;)
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
e = ( "\n" +
"\n".join(["\n" +
"\n".join(["{}".format(z[i]) for z in y]) +
"\n" for i in range(len(y[0]))]) +
"\n" )
print table
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
abs or Watford Electronics I expect.
I also remember soldering switches to TEAC drives from RS to make them
40 / 80 track switchable.
Duncan, your name looks mighty familiar . Do you know a Judith?
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
s", nonsense( ( 5, "donuts", ) ) )
The above code shows there is no automatic connection between data output
carried out within a function and the value (if any) returned by that
function.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, 04 Oct 2014 17:52:18 +0200, Tamer Higazi wrote:
> I am planing to develop on longer time a n open source Webmailer written
> in Python (not 2.7.x) with:
Because the world really needs another webmailer spamengine.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.pyth
that list. now loop through the second list and print results.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
he two different expressions
give the same result for a suitable range of values of x:
for x in range(50):
if not (15 <= x < 30) == ((15 <= x) and (x < 30)):
print "discrepancy"
or
for x in range(50):
if (15 <= x < 30) == ((15 <= x) and (x < 30
nd look again at how
you're specifying which node(s) you want to select.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
.HIGH:
print True
else:
print False
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
ding of combinatorial logic,
perhaps http://www.ee.surrey.ac.uk/Projects/Labview/boolalgebra/
index.html#booleantheorems will help.
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
to output file
4/ close the input file
5/ close the output file
Or in several other ways, and once you have an algorithm, you can start
coding it (or implementing it in the programming language of your choice,
whichever form of words best pleases your perfesser).
--
Denis McMahon, denismfmc
be a list of dicts.
>
> Does that help?
It think it would be a dict of dicts:
shopping = { "store1" : { "item1": price1, "item2": price2, ... },
"store2" : { "item3": price3, "item4": price4, ... }, ... }
--
Denis McMahon, denismfmcma...@gmail.com
--
https://mail.python.org/mailman/listinfo/python-list
string to a tuple such as ( string, number ):
>>> x = [ "fred", "jim", "susan" ]
>>> x[x.index("jim")] = ( "jim", 11, )
>>> print x
['fred', ('jim', 11), 'susan']
> Do you have to know the n
t with individual members
arr2 = [ arr1[0], arr1[3], arr1[5] ]
# create a new list by adding slices together
arr3 = arr1[:1] + arr1[2:4] + arr1[5:]
print arr2
# output is: ['a', 1, 3]
print arr3
# output is: ['a', 'c', 1, 3]
--
Denis McMahon, denismfmcma...@gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
1 times
if you want to check that thing is a 2 int tuple then use something like:
for thing in mylist:
if isinstance( thing, tuple ) and len( thing ) == 2 and isinstance
( thing[0], ( int, long ) ) and isinstance( thing[1], ( int, long) ):
if thing in bits:
ange and how you change it is probably your homework task, so
I really shouldn't tell you any more than that.
Also, I might not be right about where you need to make the change, but
hey, this is the internet, it must be right, yeah?
--
Denis McMahon, denismfmcma...@gmail.com
--
http://m
type(b) == classobj
> Traceback (most recent call last):
> File "", line 1, in ?
> NameError: name 'classobj' is not defined
You can compare it against the ClassType object located in the types module.
> import types
> class b:
def __init__(self):
...
The script could be SUID Root, and you could use os.setuid immediately after
having performed the task to switch to a non-priviledged user. May be a big
security risk, if someone can alter the script, he gains root access to the
system...
[EMAIL PROTECTED] wrote:
> hello,
>
> i am writing a pyth
Why does list have no 'get' method with exactly the same semantics as
dict's get,
that is "return an element if there is one, but do NOT raise
an exception if there is not.":
def get(self, item, default = None):
try:
return self[item]
except IndexError:
Tim Golden wrote:
> Dodging your question slightly (and at the risk of teaching
> my grandmother to suck eggs) I sometimes use this idiom for
> checking params. Obviously it only goes so far, but it's
> fairly compact:
>
> import os, sys
> if __name__ == '__main__':
> ARGS = None, "DEV"
> f
Steve Holden wrote:
> These versions differ with respect to treatment of blank lines, which
> indicates how easy it is to go astray in this kind of semantic
> optimization. Your example simply wouldn't work (though you could patch
> it up using "if line is None". (despite the use of short-circuiti
ckslash. In Python 3.0 you don't need
to do this because all strings are "unicode" to start with. I suspect
you will see the same error with 2.6 on Windows once you correct this.
(note to Giampaolo: sorry, resending this because I accidentally
selected "reply" instead of "reply to all")
--
Denis Kasak
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Jan 27, 2009 at 7:08 PM, Thorsten Kampe
wrote:
> * Denis Kasak (Tue, 27 Jan 2009 14:22:32 +0100)
>> On Tue, Jan 27, 2009 at 1:52 PM, Giampaolo Rodola'
>> wrote:
>> >>>> print unicode('\u20ac')
>> > \u20ac
>>
>> S
On Mon, Feb 2, 2009 at 10:43 PM, Lionel wrote:
> >>> ResourcefilePath
> 'C:\\C8Example1.slc.rsc'
> C:\C8Example1.slc.src
The extension you used in the interactive shell differs from the one
you used in the class code (i.e. "rsc" vs "src").
-
401 - 500 of 564 matches
Mail list logo