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
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