On 06/12/2013 10:49 PM, Jim Mooney wrote:
Raised when a built-in operation or function receives an argument that has
the right type but an inappropriate value, and the situation is not
described by a more precise exception such as
On 04/16/2013 07:48 PM, Jim Mooney wrote:
I accidentally sent as HTML so this is a resend in case that choked
the mailing prog ;')
I was doing a simple training prog to figure monetary change, and
wanted to avoid computer inaccuracy by using only two-decimal input
and not using division or
On 04/17/2013 02:34 AM, eryksun wrote:
I just went through the steps. You don't even need your password.
Enter your email address in the bottom field of the list info page:
http://mail.python.org/mailman/listinfo/tutor
Click the button that says Unsubscribe or edit options. Then simply
Marilyn Davis schreef op wo 14-11-2012 om 13:23 [-0800]:
I found this site:
http://hints.macworld.com/article.php?story=20100713130450549
and that fixes it.
Short answer: It is not a fix but a workaround. Try:
print symbol.encode('utf-8')
Longer answer: It is not really a fix, it is a
Hi List,
I am looking for resources on creating xml files in python. I have found some
resources but they all are very basic. I find lots of resources online about
parsing and searching in an xml file but not so much about creating them.
Do any of you know of good online resources? I found an
Op zaterdag 27 oktober 2012 03:30:26 schreef Steven D'Aprano:
On 27/10/12 03:14, Sander Sweers wrote:
Do any of you know of good online resources? I found an o'reilly book [1]
do you know if it is any good?
[1] http://shop.oreilly.com/product/9780596001285.do
For those of us who have
Op vrijdag 26 oktober 2012 17:00:16 schreef Prasad, Ramit:
Based on the most recent comment (May 2010) I would probably
stick with online tutorials.
I generally do not trust reviews on the publisher's website as they have
been proved to be constructed by them.
Here are some tutorials for
Alan Gauld schreef op wo 24-10-2012 om 17:49 [+0100]:
I confess I'm not keen on the else part of a for loop and never use
it,
I think it leads to more confusion than anything. It doesn't do what
most folks seem to expect, it should probably be called 'end' or
something similar rather than
Norman Khine schreef op zo 14-10-2012 om 23:10 [+0100]:
One thing is that when I try to write the assoc_data into a CSV file,
it groaks on
UnicodeEncodeError: 'ascii' codec can't encode character u'\xc7' in position
0:
It looks like python is doing an implicit decode/encode on one of your
Please don't top post.
On Mon, Oct 15, 2012 at 12:12 AM, Sander Sweers sander.swe...@gmail.com
wrote:
Norman Khine schreef op zo 14-10-2012 om 23:10 [+0100]:
One thing is that when I try to write the assoc_data into a CSV file,
it groaks on
UnicodeEncodeError: 'ascii' codec can't
Sander Sweers schreef op ma 15-10-2012 om 02:35 [+0200]:
On Mon, Oct 15, 2012 at 12:12 AM, Sander Sweers sander.swe...@gmail.com
wrote:
Norman Khine schreef op zo 14-10-2012 om 23:10 [+0100]:
Norman Khine schreef op ma 15-10-2012 om 00:17 [+0100]:
i tried this: http://pastie.org
Op 7 okt. 2012 04:29 schreef aklei...@sonic.net het volgende:
I'm also not sure but I seem to remember that it is
(SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,
SATURDAY, SUNDAY)
which I think is extremely clever because it gets around the problem
created by the fact that some people
Roel Schroeven schreef op zo 07-10-2012 om 21:19 [+0200]:
Sander Sweers schreef:
Op 7 okt. 2012 04:29 schreef aklei...@sonic.net
mailto:aklei...@sonic.net het volgende:
I'm also not sure but I seem to remember that it is
(SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY
https://www.youtube.com/watch?v=sgHbC6udIqc
This is a very good talk on Unicode which was done at PyCon US 2012.
It helped me a lot to understand the pain.
Greets
Sander
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription
On 17 February 2012 14:04, leam hall leamh...@gmail.com wrote:
My concern with variables is that they have to be passed in specific
order to the function, and they may have to have their type set
multiple times so that you can perform the right functions on them. In
a dict you could set it on
On 5 November 2011 00:38, Dinara Vakhitova di.marvell...@gmail.com wrote:
Sorry, I didn´t know that I couldn´t ask questions about the homework...
This list is meant to help with learning python and not to do
homework assignments. So if you get stuck with something yes you can
post it but be
On Thu, 3 Nov 2011, 06:12:58 CET, Mike Nickey mnic...@gmail.com wrote:
I am hoping that there is a Python ADK that will allow creation of
apps with Python but I haven't seen one and wanted to see what you know is
out there.
Linux journal has an article on this [1]. I have no experience in
On Mon, 24 Oct 2011, 20:04:20 CEST, Johan Martinez jmart...@gmail.com wrote:
I am struggling to understand Python string immutability. I am able to
modify Python string object after initializing/assigning it a value. So
how does immutability work? I am not following it. Sorry for really
On 17/09/11 13:08, lists wrote:
I have been trying to learn how to parse XML with Python and learn how
to use xml.etree. Lots of the tutorials seem to be very long winded.
I'm trying to access a UK postcode API at www.uk-postcodes.com to take
a UK postcode and return the lat/lng of the
On Tue, 13 Sep 2011, 21:01:56 CEST, Alan Gauld alan.ga...@btinternet.com
wrote:
On 13/09/11 16:41, Susana Iraiis Delgado Rodriguez wrote:
structure. About the indention for the code, I tried my best to make it
clear ande neat. But the mi e-mail editor it's mixing-up spaces.
OK, That's
On 12/09/11 21:15, nitin chandra wrote:
I need to create a calendar with python CSS for the web page, in the
following format
Dec , 2011
-
sun | mon | tue | wed
On Thu, 1 Sep 2011, 01:17:45 CEST, questions anon questions.a...@gmail.com
wrote:
Firstly just make them zeros and ones, for example if the values in the
array are less than 100 make them 0 and if greater than 100 make them 1.
And then finally sum them together.
I have attempted a few
On 31 August 2011 09:46, Johan Geldenhuys jo...@accesstel.com.au wrote:
I am trying to use a very simple piece of code to get the realm from
different HTTPS URLs.
This realm is essential for successful authentication on the HTTPS session.
I think you got 2 things mixed up, http authentication
On 31 August 2011 14:27, Johan Geldenhuys jo...@accesstel.com.au wrote:
On 31/08/2011, at 22:09, Sander Sweers sander.swe...@gmail.com wrote:
On 31 August 2011 09:46, Johan Geldenhuys jo...@accesstel.com.au wrote:
I am trying to use a very simple piece of code to get the realm from
different
On 31 August 2011 21:14, Cranky Frankie cranky.fran...@gmail.com wrote:
I made some headway on the quote of the day program. I just tried to
do it simple using two assumptions:
- long quotes are going to print funny until I figure out the string
splitting stuff
Define funny? Normally the
On Wed, 24 Aug 2011, 00:03:23 CEST, Robert Sjoblom robert.sjob...@gmail.com
wrote:
Are you using Python 3 and urllib, and not using httplib2? Because I
honestly can't get urllib.request.urlopen to work with
http://www.boursorama.com/ -- I only get b'' from there.
Yes, Python 3.2
On 23/08/11 21:27, Robert Sjoblom wrote:
Here's the code I'm working with:
from http.client import HTTPConnection
HTTPConnection.debuglevel = 1
from urllib.request import urlopen
url =
http://www.boursorama.com/includes/cours/last_transactions.phtml?symbole=1xEURUS;
response = urlopen(url)
On 23 August 2011 22:59, Robert Sjoblom robert.sjob...@gmail.com wrote:
Are you using Python 3 and urllib, and not using httplib2? Because I
honestly can't get urllib.request.urlopen to work with
http://www.boursorama.com/ -- I only get b'' from there.
Yes, Python 3.2 which version one are you
On 4 August 2011 01:16, David ld...@gmx.net wrote:
I got an error message that surprises me. I know how to solve the
problem (couple of parentheses will do), but I would expect Python to
run as the code is presented below.
After all, my_weight is a number that can be multiplied by a float.
I
On 19 July 2011 13:20, Johan Geldenhuys jo...@accesstel.com.au wrote:
It works fine for me in an interactive idle session.. Have you tried
this to see if works like this? Does the command work when run
directly from the command line?
I am using pexpect in a script to SCP files to a inux server.
On 14 June 2011 15:20, amt 0101...@gmail.com wrote:
But I can't understand at line 2 and 3. I mean it makes no difference
for me. Saying 30 or 30.0 is the same thing.
As well as saying 97 or 97.0.
Precisely, thats why I asked the question.
As a beginner at line 2 and 3 I see no point of
On Wed, 25 May 2011, 19:25:59 CEST, Wolf Halton wolf.hal...@gmail.com wrote:
[code]
def new_pass():
series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-',
'=', \
'~', '!', '@', '#', '$', '%', '^', '', '*', '(',
')', '_',
'+', \
On Tue, 17 May 2011, 19:20:42 CEST, Vikram K kpguy1...@gmail.com wrote:
I wish to read a large data file (file size is around 1.8 MB) and
manipulate the data in this file. Just reading and writing the first 500
lines of this file is causing a problem. I wrote:
Unless you are very constrained
On 29 March 2011 22:03, ranjan das ranjand2...@gmail.com wrote:
List=[( 'G1', 'CFS', 'FCL', 'R1' ),('G3', 'LOOSEFREIGHT', 'MIXEDLCL', 'R9'),
('G4', 'CFS', 'FCL', 'R10' ), ('G2', 'LOOSEFREIGHT', 'LCL', 'R4' ), ('G1',
'CFS', 'FCL', 'R2' ), ('G2', 'LOOSEFREIGHT', 'LCL', 'R5') ]
now I want to
On 29 March 2011 23:52, Sander Sweers sander.swe...@gmail.com wrote:
On 29 March 2011 22:03, ranjan das ranjand2...@gmail.com wrote:
New_List=[ [ ( 'G1', 'CFS', 'FCL', 'R1' ), ('G1', 'CFS', 'FCL', 'R2' ),
('G4', 'CFS', 'FCL', 'R10' ) ], [ ('G2', 'LOOSEFREIGHT', 'LCL', 'R4' ),
('G2
2011/3/29 Rafael Durán Castañeda rafadurancastan...@gmail.com:
And more pythonic, I think
I don't agree :-). I think itemgetter from the operator module is more
flexible, readable and elegant than using a lamda. How would you sort
on the first and last item with lambda?
Greets
Sander
On 30 March 2011 00:30, Alan Gauld alan.ga...@btinternet.com wrote:
Wouldn't you just return a tuple of the two elements?
Or am I missing something having jumped into the middle of the thread...
Ah yes, you are correct. But imo reading key=lambda l: (l[1], l[0],
l[2]) (which would be needed to
On Tue, 8 Mar 2011, 07:44:31 CET, Becky Mcquilling ladymcse2...@gmail.com
wrote:
gpg = 'c:/program files (x86)/gnu/gnupg/gpg2.exe'
gpg = 'c:/program files (x86)/gnu/gnupg/gpg2.exe'
subprocess.Popen('gpg', shell=True)
It fails to run gpg and is not expanding the variable. Is there a
On Tue, 1 Mar 2011, 01:02:23 CET, Jacob Bender benderjaco...@gmail.com
wrote:
I'm trying to be a host without having to keep the computer on ALL
of the time. Acting as a Dropbox would be an example. My IP doesn't
change very often. It's stayed the same for days.
The best
On 19 December 2010 13:43, lei yang yanglei.f...@gmail.com wrote:
Right, it gets stuck at the readline(), is there a function not get
stuck to instead of readline().
readline() will keep reading stdout until it received a newline
character. So if there is nothing to read it will wait forever.
On 19 December 2010 21:54, jtl999 jacksmoo...@gmail.com wrote:
File GettingStarted.py, line 91
print (Lesson Two)
^
SyntaxError: invalid syntax
Python 2.6.5
You are using a howto for python version 3.X but you are using python
2.X. In python 3 the print statement was changed to a
On 7 December 2010 00:16, Steven D'Aprano st...@pearwood.info wrote:
Oh boy, is that a can of worms... and this is going to be a long post. You
might want to go make yourself a coffee first :)
Great writeup and much appreciated :-).
Thx
Sander
___
On 25 October 2010 14:46, Richard D. Moores rdmoo...@gmail.com wrote:
I'd like to convert the script to 3.1, but I can't understand the docs
for the 3.1 urllib module. Please someone tell me what to do.
(Converting 'print rate' to 'print(rate)' I understand.)
Have you actually tried
On 25 October 2010 18:19, Richard D. Moores rdmoo...@gmail.com wrote:
Doing it your way,
from urllib import request
a =
request.urlopen('http://www.marketwatch.com/investing/currency/CUR_USDYEN').read(20500)
print(a[123:140])
succeeds. Why?
Not sure how this exactly works but this is
On 21 October 2010 18:09, Richard D. Moores rdmoo...@gmail.com wrote:
In case anyone's interested, the script now works the way I wanted:
http://tutoree7.pastebin.com/f9nDehNc. It should work for anyone
with 2.6 or 2.7
I'd appreciate constructive criticism.
Instead of all the zeros2float
On 19 October 2010 21:56, Tim Johnson t...@johnsons-web.com wrote:
I've written the following function which successfully gets an
authenticated URL:
def getRestrictedURL(authName,URL,log,pswd):
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password(authName,
On 14 October 2010 16:14, David Hutto smokefl...@gmail.com wrote:
(u'graph1', u'Line', u'222', u'BLUE', u'1,2,3,4', u'True', u'0,5,0,10')
Which is a tuple of unicode strings. From this I
need to place portions of the tuple into other fields,
but not as unicode strings, but literals no ''.
On 14 October 2010 20:29, David Hutto smokefl...@gmail.com wrote:
Actually, I needed it to be converted to something without a string
attached to it. See a post above, and it was fixed by eval(),
Using eval is a big security risk and is generally not recommended for
any production code. What do
On 14 October 2010 21:02, Sander Sweers sander.swe...@gmail.com wrote:
If you really want (you really don't) to use eval() then at least use
Oops, hit send to soon. (you really don't) should have been (you
really don't need to use it).
Greets
Sander
On 12 October 2010 21:15, Joel Goldstick joel.goldst...@gmail.com wrote:
When the dictionary is retrieved, its order depends on the hashed values
rather than the keys themself.
If (big IF here) you really need an ordered dict you can use the
OrderedDict from the collections module. However this
On 28 September 2010 23:58, Alex Hall mehg...@gmail.com wrote:
Hi all, yet again:
I have a dictionary that will look something like:
d={
(1,2):a,
(3,4):b
}
How can I say:
if (1,2) in d: print d[(1,2)]
This will work fine.
This is false
Not it is not..
d = {(1,2):a,(3,4):b}
(1,2)
On 27 September 2010 22:00, Alex Hall mehg...@gmail.com wrote:
That makes sense. Basically, the * operator in this case acts as a
copying command. For simple data types this is fine, but throw in a
complex type, in this case a list (though I expect that any object
would do this) and you are
On 27 September 2010 23:15, Sander Sweers sander.swe...@gmail.com wrote:
objects: copying the memory location, not making a deep copy and
getting a duplicate object.
It does not copy the object it makes multiple _references_ to the *same*
object.
Oops, You already got the idea and I should
- Original message -
Look at the backslash! It doesn't strip the backslash in the string, but
it escapes the double quote following it.
I don't know how people can explain it any better.
Maybe the link below makes it clear what backslash really does.
On 6 September 2010 19:32, Roelof Wobben rwob...@hotmail.com wrote:
def index_of(val, seq, start=0):
index_of(9, [1, 7, 11, 9, 10])
3
index_of(5, (1, 2, 4, 5, 6, 10, 5, 5))
3
index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)
6
index_of('y',
On 6 September 2010 22:28, Roelof Wobben rwob...@hotmail.com wrote:
As far as I know index is not a part of tuple so I have to convert it to a
list so I can use index.
As of version 2.6/3 a tuple does have index(). Not sure which version
you are using.
Greets
Sander
On 6 September 2010 21:45, Sander Sweers sander.swe...@gmail.com wrote:
Is the exercise here wrong ?
Looks like it, or it's a typo.
Now that I had a better look the test is correct. Now it is up to you
to figure out why your index_of() fails. Walter gave you a good hint.
Greets
Sander
On 7 September 2010 00:14, lists li...@justuber.com wrote:
Assuming that mytext is test, I've found that mytext[-1:-4:-1]
doesn't work (as I expected it to) but that mytext[::-1] does.
While that's fine, I just wondered why mytext[-1:-4:-1] doesn't work?
How does it not work? What did you
On 4 September 2010 19:14, Bill Allen walle...@gmail.com wrote:
Say I have and iterable called some_stuff which is thousands of items in
length and I am looping thru it as such:
for x in some_stuff
etc...
However, what if I want only to iterate through only the first ten items of
On 4 September 2010 19:25, Sander Sweers sander.swe...@gmail.com wrote:
for x in some_stuff:
if x = 10:
print x
else:
break
Oops, corrected version...
count = 0
for x in some_stuff:
if count 10:
print x
count +=1
else:
break
Greets
On 27 August 2010 18:25, Albert-Jan Roskam fo...@yahoo.com wrote:
First, thanks for your previous replies. I cannot use IrfanView any time
soon, nor will my boss switch to Linux.
Why not use graphicsmagick [1] which also provides a windows binary
[2]. You can execute it with the subprocess [3]
On 25 August 2010 00:04, Joe Veldhuis electrob...@gmail.com wrote:
Hello to all. I'm working on writing a tool that will control a piece of
hardware using ioctl's on its device node. Specifically, I'm trying to
configure and tune a DVB-S receiver on Linux.
Just for starters, I want to try
On 23 August 2010 17:13, aug dawg augdaw...@gmail.com wrote:
Is there a command or module that I can use to add all the items in a list?
Alternatively, is there one I can use to add all the numbers in a file?
sum() is what you are looking for [1].
Greets
Sander
[1]
On 23 August 2010 17:24, aug dawg augdaw...@gmail.com wrote:
So it's sum(list_name) ?
Correct, but it is not limited to lists. Any itterable with
ints/floats will do, for example a tuple is also accepted.
Greets
Sander
PS: Please use reply to all so others on this list may benefit from
the
On 18 August 2010 17:14, nitin chandra nitinchand...@gmail.com wrote:
I am on Python 2.6
snipped a whole lot of text
Please guide with the syntax.
All beginners tutorials on the web teach the syntax of python.. I am
unsure what your questions is.
below is the existing program with Formula A
On 12 August 2010 09:44, Alan Gauld alan.ga...@btinternet.com wrote:
I'm wondering what's the fastet datatype in python to lookup the last
element in an ordered collection.
When in doubt timeit()
Out of curiosity I used timeit and lists are faster if we iterate over
them one by one. Now this
On 12 August 2010 10:40, Evert Rol evert@gmail.com wrote:
a = my file number
a.replace(' ', '\\ ')
'my\\ file\\ number'
What if a has more than 1 space between words? Then I think this would
be a safer way.
print \\ .join(my file number.split())
my\ file\ number
Greets
Sander
On 12 August 2010 12:07, Sander Sweers sander.swe...@gmail.com wrote:
Deque took 0.009195 seconds
693.01178383827209 / 10 (default times run by timeit)
Messed up the deque results :(
Deque took 0.009195 seconds
919.49732708930969 / 10 (default times run by timeit)
Greets
Sander
On 7 August 2010 04:35, TGW galaxywatc...@gmail.com wrote:
I have a pipe delimited text file with 5 columns which looks like this:
12345|some text|some more text|example125 oo3 3456|example32423
11223|more text|and more|example/73d 77665|example455667
12677|text|more|anotherexample
On 7 August 2010 13:45, TGW galaxywatc...@gmail.com wrote:
You can test if one item in your list begins with example like:
' example125 oo3 3456'.lstrip()[:7].lower() == 'example'
I think I need to use regex here. Perhaps you will agree.
You could but you don't have to, consider this.
r =
On 5 August 2010 06:38, Vikram K kpguy1...@gmail.com wrote:
Suppose i have this string:
z = 'AT/CG'
How do i get this list:
zlist = ['A','T/C','G']
If you know the format of the string is always the same you can do
something like this. This fails when you have strings that do not have
the
- Original message -
I'm using Python 2.6.5 and I've got a challenge with the subprocess
module. I'd like the output to be stored in a variable, and not sent to
the stdout. The relevant lines as they are now:
Go to google, enter pymotw subprocess and hit I am feeling lucky ;-)
greets
On 5 July 2010 17:40, Shashwat Anand anand.shash...@gmail.com wrote:
use input() instead of raw_input() in Python3.x
To add to this, in Python 2 we had input() [1] (unsafe for most uses)
and raw_input() [2] (safe). Python 3 removed the old input() and
renamed raw_input() to input() [3,4].
On 5 July 2010 19:54, Vineeth Rakesh vineethrak...@gmail.com wrote:
Can some one help me to return a special pattern from a list.
say list =
[something1.mp3,something2.mp3,something4.pdf,something5.odt]
now say I just need to return the files with .mp3 extension. How to go about
doing this?
- Original message -
On Fri, 25 Jun 2010 04:51:13 am Lie Ryan wrote:
On 06/24/10 02:10, pyt...@bdurham.com wrote:
Can someone confirm that Python 2.6 ftplib does *NOT* support
Unicode file names? Or must Unicode file names be specially
encoded in order to be used with the
On 12 June 2010 20:22, Wayne Werner waynejwer...@gmail.com wrote:
I want to be able to grab a webcam image via python. So I'm curious if
anyone has had any experience/luck in this particular area and/or knows of
any libraries I should take a look at. I know my webcam definitely works
under
On 11 June 2010 15:57, Ken G. beach...@insightbb.com wrote:
In any event, if a number is listed more than once, I would like to know how
many times, such as 2 or 3 times. For example, '3' is listed twice within a
list.
If you do not have top keep the order of the number this will work.
a =
On 3 June 2010 21:02, Colin Talbert talbe...@usgs.gov wrote:
I couldn't find any example of it in use and wasn't having any luck getting
it to work based on the documentation.
Good examples of the bz2 module can be found at [1].
greets
Sander
[1] http://www.doughellmann.com/PyMOTW/bz2/
2010/5/28 spir ☣ denis.s...@gmail.com:
his is a different feature from preserving *input* order of of keys, or of
key:value pairs.
In Python 2.7 and 3.1 [1] we now have the OrderedDict which does
preserve input order.
Greets
Sander
[1] http://www.python.org/dev/peps/pep-0372/
On 22 May 2010 09:46, prasad rao prasadarao...@gmail.com wrote:
csvw=csv.writer(open('/home/prasad/kkm','w'),
dialect='excel',fieldnames=names)
Traceback (most recent call last):
File stdin, line 1, in module
TypeError: 'fieldnames' is an invalid keyword argument for this function
On 26 April 2010 15:00, Matthew Williams m...@doctors.org.uk wrote:
What I'm looking for is a way to explicity reset the iterator, to tell it to
go back to the beginning.
You will need to use the seek method on the fileobject.
f = open('insert your csv file here.csv', 'rb') #Note the b in 'rb'
On 26 April 2010 21:38, C M Caine cmca...@googlemail.com wrote:
Why does this not work:
L = [' foo ','bar ']
for i in L:
i = i.strip()
str.strip() _returns_ a *new* string and leaves the original string
alone. The reason being that string are immutable so can not be
changed.
s1 = ' foo
On 12 April 2010 22:13, Dave Angel da...@ieee.org wrote:
When combining directory paths, it's generally safer to use
os.path.join()
As KDE/Dolphin runs on windows this is even more important as it will
sort out the directory separator (/ vs \) for you.
Some added reading on os.path can be
On 13 March 2010 18:33, Ray Parrish c...@cmc.net wrote:
Hello,
I am getting the following -
String = a href=http://www.rayslinks.com;Ray's Links/a
String
'a href=http://www.rayslinks.com;Ray\'s Links/a'
Note the magically appearing back slash in my result string.
It is not really there.
On 10 March 2010 21:02, Alan Harris-Reid aharrisr...@googlemail.com wrote:
Maybe I have misunderstood you, but I always thought that the 'finally'
section was run even if the 'try' section is successful, in which case I
would not want a rollback.
I was thinking something like this.
import
- Original message -
I am using the sqlite3 module with Python 3.1, and have some code which
goes something like as follows...
import sqlite3
con = sqlite3.connect('MyDatabase.db')
try:
execresult = con.execute('INSERT INTO MyTable (field_name) VALUES
(MyValue)')
On 3 March 2010 14:17, Kent Johnson ken...@tds.net wrote:
After six years of tutor posts my interest and energy have waned and
I'm ready to move on to something new.
Let me join the other people and thank you for your contribution to
this list. Good luck with something new :-)
Greets
Sander
On 3 March 2010 20:44, Giorgio anothernetfel...@gmail.com wrote:
s = ciao è ciao
print s
ciao è ciao
s.encode('utf-8')
Traceback (most recent call last):
File pyshell#2, line 1, in module
s.encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 5:
On 3 March 2010 22:41, Sander Sweers sander.swe...@gmail.com wrote:
It is confusing but once understand how it works it makes sense.
I remembered Kent explained it very clear in [1].
Greets
Sander
[1] http://mail.python.org/pipermail/tutor/2009-May/068920.html
On 17 February 2010 22:37, David Perlman dperl...@wisc.edu wrote:
As far as I can tell, this should always work. So wouldn't it be nice if
there were a less convoluted way to get this??
There is pytz [1] which should provide a simpler way to manage
timezone info in python.
Greets
Sander
[1]
On 16 February 2010 21:32, Shurui Liu (Aaron Liu) shuru...@gmail.com wrote:
Here is a program I wrote, I don't know why I cannot exit when I tried 10
times? Hope somebody can help me. Thank you!
while (guess != the_number):
if (guess the_number):
print (Lower...)
print
On do, 2010-02-11 at 10:09 -0600, Randy Raymond wrote:
I am running Python 2.6.4 under Windows Vista 32-bit Home Edition.
When I run:
import shelve
test=shelve.open(myTest.fil)
And to shich directory does this file get written? I suspect you are
writing to a protected directory. When no
On ma, 2010-02-08 at 13:02 -0800, bevan j wrote:
data = '1/09/1978 1:00:00 a.m.'
If you know this will always be in the form of 'a.m.' you can replace it
with 'am' by data.replace('a.m.','am').
Greets
Sander
___
Tutor maillist - Tutor@python.org
On vr, 2010-02-05 at 16:54 +, Antonio de la Fuente wrote:
http://openbookproject.net/thinkcs/python/english2e/ch05.html
exercise number 3 (slope function) and when I run it:
python ch05.py -v
the doctest for the slope function failed, because is expecting a
floating point value and
On vr, 2010-02-05 at 20:39 +, ALAN GAULD wrote:
return float(x1-y1)/(x2-y2)
Does not work properly in version 2. Example is the 3rd doc test:
float((3-2)/(3-1)) gives 0.0 instead of 0.5.
Greets
Sander
___
Tutor maillist - Tutor@python.org
To
On do, 2010-02-04 at 13:30 -0500, Serdar Tumgoren wrote:
Could you all indulge me one last time and tell me if the above
version works for you? If so, I'll update the recipe to spare others a
similar headache.
It now works ok but..
You should not use ord as variable as ord() is used by python
On 31 January 2010 16:40, Ken G. beach...@insightbb.com wrote:
Below is a program to determine when my next appointment is. Line numbers
are provided for reference only.
01 import time, datetime, sys
02 from datetime import date
03 today = date.today()
04 print
05 print Today date
On 31 January 2010 22:21, invincible patriot
invincible_patr...@hotmail.com wrote:
can any one tel me how can i do indexing of individual characters in python
like if i hav a word eg david
a='david'
b=list(a)
# this will give ['d','a','v','i','d']
not i want to print the index of each
2010/1/13 Albert-Jan Roskam fo...@yahoo.com
Interesting. Can this also be used to make sorting of alphanumerical list
items in a 'numerical' way easier?
x
['var_0', 'var_13', 'var_11', 'var_9', 'var_4', 'var_1', 'var_5', 'var_6',
'var_7', 'var_14', 'var_2', 'var_3', 'var_8', 'var_10',
On Tue, 2009-12-08 at 14:55 -0800, Roy Hinkelman wrote:
shutil.copy2(_files_to_mod + \\ + fname, _files_to_mod + \\ +
new_name)
You can make os.path.join sort out the directory seprator for you. It
will add a / under linux and \ under windows.
os.path.join('Testing dir','oldname
1 - 100 of 219 matches
Mail list logo