nothing, Alan wrote:
> On Nov 16, 8:28 pm, martyw <[EMAIL PROTECTED]> wrote:
>> i would create a class to capture country information, e.g.
>
>
> What is the advantage of this:
>
>> def __cmp__(self, other):
>> if self.name < other.name:
>> return -1
>> elif s
On Sat, 2007-11-17 at 03:34 -0800, [EMAIL PROTECTED] wrote:
> #This seems to not work today and I don't know why
> #for country in countries_list:
> #if country not in REGIONS_COUNTRIES['European Union'] or not in
> REGIONS_COUNTRIES['North America']:
> #print "%s is not in the expecte
En Sat, 17 Nov 2007 08:34:43 -0300, <[EMAIL PROTECTED]> escribió:
> for i, country in countries_list:
> if country in REGIONS_COUNTRIES['European Union']:
> matrix.write(i+2, 1, country)
> but I got "ValueError: too many values to unpack"
Remove the i, and try again...
--
Gabriel
This is how I solved it last night in my inefficient sort of way and
after re-reading some of my Python books on dictionaries. So far this
gets the job done. However, I'd like to test if there are any
countries in the excel input that are not represented, ie the input is
all the information I hav
About the sort:
Check this (also on http://pastebin.com/f12b5b6ca )
def make_regions():
# Values you provided
EU = ["Austria","Belgium", "Cyprus","Czech Republic",
"Denmark","Estonia", "Finland"]
NA = ["Canada", "United States"]
AP = ["Australia", "China", "Hong Kong", "India
Great, this is very helpful. I'm new to Python, so hence the
inefficient or nonsensical code!
>
> 2) I would suggest using countries.sort(...) or sorted(countries,...),
> specifying cmp or key options too sort by region instead.
>
I don't understand how to do this. The countries.sort() lists
al
On Nov 16, 8:28 pm, martyw <[EMAIL PROTECTED]> wrote:
>
> i would create a class to capture country information, e.g.
What is the advantage of this:
> def __cmp__(self, other):
> if self.name < other.name:
> return -1
> elif self.name > other.name:
>
[EMAIL PROTECTED] wrote:
> Hi all,
>
> I'm analyzing some data that has a lot of country data. What I need
> to do is sort through this data and output it into an excel doc with
> summary information. The countries, though, need to be sorted by
> region, but the way I thought I could do it isn't
Just a few notes:
1) get_countries_list
What is the purpose of that function? Besides a few errors (an
argument named list, no value returned), it seems you just want to
remove duplicates from a list called countries. You can do that
transforming the list to a 'set'.
new_countries = list( set(c
Hi all,
I'm analyzing some data that has a lot of country data. What I need
to do is sort through this data and output it into an excel doc with
summary information. The countries, though, need to be sorted by
region, but the way I thought I could do it isn't quite working out.
So far I can only
10 matches
Mail list logo