On 07/10/2013 11:24 PM, Sivaram Neelakantan wrote:
I'm aware of
var1, var2 = lines.split()
kind of assignments
How do I get to do
x1..xn = lines.split()
instead of typing out n var names? Is there some pythonic way to map
all the data fields automagically given a starter var?
I have data
On 11/07/13 05:02, Jim Mooney wrote:
The question is - does importing into a function
ever make sense? It occurred to me that if you usefrom module
import * , putting it in a function protects you from invisible
namespace pollution by a big module with a lot of names. But importing
has to b
On 07/10/2013 05:16 PM, eryksun wrote:
On Wed, Jul 10, 2013 at 3:57 PM, Dave Angel wrote:
Sure enough it did. The question is - does importing into a function
ever make sense? It occurred to me that if you usefrom module
import * , putting it in a function
Can't be done. Locals of a fu
On 07/10/2013 05:05 PM, s...@luo.to wrote:
def printMax(a, b):
if a > b:
print(a, 'is maximum')
elif a == b:
print(a, 'is equal to', b)
else:
print(b, 'is maximum')
printMax(3, 4) # directly give literal values
x = 5
y = 7
printMax(x, y) # give variables as arg
def printMax(a, b):
if a > b:
print(a, 'is maximum')
elif a == b:
print(a, 'is equal to', b)
else:
print(b, 'is maximum')
printMax(3, 4) # directly give literal values
x = 5
y = 7
printMax(x, y) # give variables as arguments
How the code above values to:
On 07/10/2013 03:02 PM, Jim Mooney wrote:
Boy, is the list busy. Python must have been mentioned on USA today,
or something ;')
Anyway, I was reading the datamodel, and it mentioned imported modules
going out of scope, which seemed odd, since I thought they were global
and never went out, or am
On Wed, Jul 10, 2013 at 10:27 AM, Alan Gauld wrote:
> On 08/07/13 06:43, Nathan Schlaffer wrote:
>
> Second, I tried to run my Python programs today via IDLE but when I
>> checked the Edit Menu I couldn't find a Run Menu
>>
>
> IDLE has two modes: Shell and Edit. Shell mode is an interactive P
On 09/07/13 21:04, HRK wrote:
PROBLEM #1
heights = {"Mount Everest": 8848, "Mount Cook": 3754, "K2": 8611,
"Ben Nevis": 1344, "Hekla": 1488}
Since you already have a dict of heights why do you pass one in to the
function each time? Why not just pass this one in? Or use it as a global?
def
On 08/07/13 07:26, Tim Hanson wrote:
In the first Lutz book, I am learning about nested functions.
def f1():
x=88
def f2():
print(x)
x=99
print(x)
f2()
f1()
Traceback (most recent call last):
print(x)
Un
On 08/07/13 06:43, Nathan Schlaffer wrote:
I have a Windows 7 Laptop. I installed Python Version 3.3.2 this morning
and it worked fine. Then I tried to run a program someone else wrote
(see below)
I didn't see anything related below. What program did you try to run?
How did you try to run it?
On 10/07/13 13:05, Dave Angel wrote:
mylist = [(row[0],0) for row in rows]
I'll guess it's the list comprehension that confuses you. That line is
roughly equivalent to:
mylist = []
for row in rows:
mylist.append( (row[0], row) )
Except the second element in the tuple to append should be
On Wed, Jul 10, 2013 at 1:41 AM, Phil wrote:
> Thank you for reading this.
>
> Kububtu 13.04 Python 3
>
> I'm attempting to read a configuration file that will restore my program
> to the state that it was in when it was closed. Ideally the config file
> would be human readable.
>
>
Python actual
On Wed, Jul 10, 2013 at 3:45 AM, Dave Angel wrote:
>
> Get rid of the BOM from the data file, and it'll work fine. You don't
> specify what version of Python you're using, so I have to guess. But
> there's a utf-8 BOM conversion of a BOM at the beginning of that file, and
> that's not numeric.
On 03/07/13 02:32, larry seibold wrote:
I am stuck at step one, installing "python-2.7.5.msi" on windows XP.
Are you sure you have the right version - 32bit v 64bit?
Just a thought.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
___
Right click the msi > run as admin
On Wednesday, 3 July 2013, larry seibold wrote:
> I am stuck at step one, installing "python-2.7.5.msi" on windows XP. I
> downloaded it (~16MB), but when I select it (double click), I get a windows
> installer pop up with an OK button at the bottom, which when
On Thu, Jul 4, 2013 at 8:47 PM, Robert Winkler <
robert.wink...@bioprocess.org> wrote:
> Thanks to the OSA library, which works for SOAP requests with Python
> 3.x, I can now use SOAP services at http://www.chemspider.com.
>
> The result is a list of accession numbers (which correspond to chemica
Hello,
On 29 June 2013 19:00, Makarand Datar wrote:
> Hi,
>
> So I am able to read in a file, and write out a file from python. I have
> some question about the text manipulation that I need to do between reading
> in a file and spitting out another. Couple of things I would like to do,
> are:
On 7/4/2013 3:47 PM, Robert Winkler wrote:
Thanks to the OSA library, which works for SOAP requests with Python
3.x, I can now use SOAP services at http://www.chemspider.com.
The result is a list of accession numbers (which correspond to
chemical compounds) and I get them in the following fo
On 07/09/2013 04:00 PM, Paul Smith wrote:
Tutor-
Ok newbie to coding here attempting to build controlled web scraper and
have followed several books-tutorials and am failing at step one.
This is the 3.3.1 code I am trying to run..
===
import urllib.request
htmltext = urllib.request.urlopen("ht
On 07/09/2013 04:04 PM, HRK wrote:
Hello,
I'm pretty new to Python so while I can make some basic stuff work, it doesn't
look particularly pretty. I wanted to find better ways to solve the following
two problems (the current code works, but is clunky.) Any tips or help
appreciated. Thanks!
On 07/08/2013 01:43 AM, Nathan Schlaffer wrote:
Dear Tutor,
I have a Windows 7 Laptop. I installed Python Version 3.3.2 this morning
and it worked fine. Then I tried to run a program someone else wrote (see
below), and Python closed.
What's that mean? HOW did you try to run the other program?
On 07/06/2013 11:18 PM, bluepresley wrote:
I'm reading the book Programming Collective Intelligence by Toby Segaran.
I'm having a lot of difficulty understanding the some of the code from
chapter four (the code for this chapter is available online at
https://github.com/cataska/programming-collect
On 07/08/2013 02:26 AM, Tim Hanson wrote:
In the first Lutz book, I am learning about nested functions.
Here's the book's example demonstrating global scope:
def f1():
x=88
def f2():
print(x)
f2()
f1()
88
But that's not global scope, it's
On 07/05/2013 05:10 PM, Ashley Fowler wrote:
This is what I have so far. Can anyone make suggestions or tell me what I need
to correct?
*
*
First thing to correct is the notion that you're due an instant answer.
You get frustrated after 3 minutes, and post a new messa
On 07/05/2013 02:37 PM, Amandeep Behl wrote:
and why with sum(one, two) we get an error whereas not with sum((one, two))
?
When replying to a message, your new text should go AFTER the quote.
Putting it first is called top-posting, and it's a Microsoft-introduced
abomination that's not compa
On 06/28/2013 07:08 PM, grub...@roadrunner.com wrote:
I don't get why this doesn't work. Its a very small program to read in a group
of numbers. I've attached the the python file and my test file. The test file
just contains one line. The error I get is that it can't convert the string to
a fl
On Tue, Jul 9, 2013 at 10:00 PM, Paul Smith wrote:
> Tutor-
>
> Ok newbie to coding here attempting to build controlled web scraper and
> have followed several books-tutorials and am failing at step one.
>
> This is the 3.3.1 code I am trying to run..
> ===
> import urllib.request
>
> htmltext = u
On Mon, Jul 8, 2013 at 8:26 AM, Tim Hanson wrote:
> In the first Lutz book, I am learning about nested functions.
>
> Here's the book's example demonstrating global scope:
> >>> def f1():
> x=88
> def f2():
> print(x)
> f2()
>
>
> >>> f1()
> 88
>
> No prob
Tutor-
Ok newbie to coding here attempting to build controlled web scraper and
have followed several books-tutorials and am failing at step one.
This is the 3.3.1 code I am trying to run..
===
import urllib.request
htmltext = urllib.request.urlopen("http://google.com";).read
print htmltext
===
Hello,
I discovered this list while doing research about the book Programming
Collective Intelligence by Toby Segaran. In the archives, a few of the
members wanted to create a group to discuss the code and algorithms
further. Those threads were a few years old, and unfortunately I'm just now
disco
so do i include a path?
or some other global directive to make the module
linked or
what?
using idle
here is a copy of the screen
i will read docs if i get links...
thanx for any guidance
i found this
but i have not used sudo
"
sudo python setup.py install
Once installed
I am tryng to figure out the best way to do Unit Testing for all my
projects going forward. I am using the unittest framework. For execution I
am executing the test cases by either directly using python or by using the
nose test runner. I found the following 3 types of how this can be setup.
Type
This is what I have to do :
On a standard telephone, the alphabetic letters are mapped
to numbers in the following fashion:
A, B, AND C=2
D, E, AND F=3
G, H, AND I=4
J, K, AND L=5
M, N, AND O=6
P, Q, R, AND S=7
T, U, AND V=8
W, X, Y AND Z=9
Write a program that asks the user to enter a 10-char
Dear Tutor,
I have a Windows 7 Laptop. I installed Python Version 3.3.2 this morning
and it worked fine. Then I tried to run a program someone else wrote (see
below), and Python closed. Then I couldn't get Python to restart even after
rebooting several times. I then uninstalled Python, rebooted, c
and why with sum(one, two) we get an error whereas not with sum((one, two))
?
On Fri, Jul 5, 2013 at 11:27 AM, Amandeep Behl wrote:
> What is the difference between max(one, two) and max((one, two)) ?
>
> Thanks
> Aman
>
___
Tutor maillist - Tutor@py
I'm reading the book Programming Collective Intelligence by Toby Segaran.
I'm having a lot of difficulty understanding the some of the code from
chapter four (the code for this chapter is available online at
https://github.com/cataska/programming-collective-intelligence-code/blob/master/chapter4/se
Hi,
So I am able to read in a file, and write out a file from python. I have
some question about the text manipulation that I need to do between reading
in a file and spitting out another. Couple of things I would like to do,
are: if the first character of a line is a comma, I would like to delete
What is the difference between max(one, two) and max((one, two)) ?
Thanks
Aman
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Thanks to the OSA library, which works for SOAP requests with Python
3.x, I can now use SOAP services at http://www.chemspider.com.
The result is a list of accession numbers (which correspond to chemical
compounds) and I get them in the following format:
|(ArrayOfInt){
int[] = [
On 28 Jun 2013 08:33, "Peter Otten" <__pete...@web.de> wrote:
>
> Whatever approach you pick, unittest, doctest, or a combination, your code
> will improve -- not just because you are verifying its correctness to some
> extent, but also because the inherent question "How can I test it?" will
> lead
I don't get why this doesn't work. Its a very small program to read in a group
of numbers. I've attached the the python file and my test file. The test file
just contains one line. The error I get is that it can't convert the string to
a float, but its a valid number.# Test for string conversion
41 matches
Mail list logo