Re: [Tutor] design advise

2009-08-27 Thread davidwilson
Thanks for the reply, but reading from my initial post I don't seem to have made my question clear ;( I was thinking more in terms of how python would find it more efficient in retrieving the information, this being: 1) Storing all the user files in one place and then selecting only the files w

[Tutor] design advise

2009-08-26 Thread davidwilson
Hello, I would like advise on what method would be better in terms of search and retrieval. In my application I need to choose how to store data for each user, for example: /news /articles /games My difficulty now comes in how to store this data in that I will need to create views of the data

Re: [Tutor] how to remove first '/'

2009-08-25 Thread davidwilson
Thank you for the replies. Original Message From: Emad Nawfal (عماد نوفل) To: davidwil...@safe-mail.net Cc: tutor@python.org Subject: Re: [Tutor] how to remove first '/' Date: Tue, 25 Aug 2009 18:01:26 -0400 > > > On Tue, Aug 25, 2009 at 5:55 PM, wrote: > > > > Hello, > >

[Tutor] how to remove first '/'

2009-08-25 Thread davidwilson
Hello, I want to strip the first '/' from the following: '/path/to/file' How can I do this? Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] python's database

2009-08-15 Thread davidwilson
Hello, I seem to remember that python had a native database, can someone remind me which this was. Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] subprocess.call

2009-07-27 Thread davidwilson
OK I think I found my error, here is what I did: flags = set([file for file in glob.glob('flag-*.svg')]) def call(cmd): subprocess.call([cmd], shell=True) for flag in flags: name = flag[:-4] out = name+'.png' call('svg2png --width=17 --height=12 %s %s' \ % (flag, o

[Tutor] subprocess.call

2009-07-27 Thread davidwilson
Hello again, >From my previous post I would now like to transform the SVG images using the >svg2png library, but am having difficulties in making it work. Here is the >code: import glob import csv from os import rename import subprocess countries = {} reader = csv.reader(open("countries.csv"))

Re: [Tutor] renaming files within a directory

2009-07-27 Thread davidwilson
Thank you all for your help. Original Message From: Dave Angel Apparently from: srs0=pajg=du=ieee.org=da...@srs.perfora.net To: davidwil...@safe-mail.net Cc: ken...@tds.net, tutor@python.org Subject: Re: Re: [Tutor] renaming files within a directory Date: Mon, 27 Jul 2009 09:01:

Re: [Tutor] renaming files within a directory

2009-07-27 Thread davidwilson
Here is the updated viersion: --- import glob import csv from os import rename countries = {} reader = csv.reader(open("countries.csv")) for row in reader: code, name = row countries[name] = code files = set([file for file in glob.glob('Flag_of_*.svg')]) for file in files: file =

Re: [Tutor] renaming files within a directory

2009-07-27 Thread davidwilson
_the_United_State Also, How do I remove 'Flag_of', 'Flag_of_the_' I guess after this I can compare the value with the key and map the tld? Or is it better to use regex and then search from the list of countries? But how??? Original Message From: Tim

Re: [Tutor] renaming files within a directory

2009-07-26 Thread davidwilson
uti'] ['er', 'Eritrea'] ... Now each row is a list with two items each. But when I do this: >>> dic = [] >>> for row in reader: ... newdic.append({row[0]: row[1]}) ... >>> dic [] I get an empty dictionary Original Message -

Re: [Tutor] renaming files within a directory

2009-07-26 Thread davidwilson
alia.svg'] >>> import csv >>> reader = csv.reader(open("country.csv")) >>> for row in reader: ... print row ['"km";"Comoros"'] ['"dj";"Djibouti"'] ['"er";"Eritrea"

[Tutor] renaming files within a directory

2009-07-26 Thread davidwilson
Hello, I have a directory containing svg/Flag_of_United_States.svg etc... Flag_of_the_Seychelles.svg Flag_of_the_Solomon_Islands.svg Flag_of_the_United_Arab_Emirates.svg Flag_of_the_United_Kingdom.svg Flag_of_the_United_States.svg Flag_of_the_Vatican_City.svg Also I have a CSV file like "us",

[Tutor] import rsvg

2009-07-25 Thread davidwilson
Hello, I have searched high and low but for the life of me I am unable to locate this module. >>> import cairo >>> import rsvg Traceback (most recent call last): File "", line 1, in ImportError: No module named rsvg >>> Basically from my previous post I would like to now manipulate the SVG

[Tutor] traversing page and then following the link

2009-07-24 Thread davidwilson
Hello, I would like to download all the flags from the http://en.wikipedia.org/wiki/Gallery_of_sovereign-state_flags so that I can create a flags sprite from this. The flags seem to follow some order in that all the svg files are in the following pattern: http://en.wikipedia.org/wiki/File:Flag

Re: [Tutor] dictionaries help

2009-07-24 Thread davidwilson
Hello Original Message From: Kent Johnson Apparently from: kent3...@gmail.com To: davidwil...@safe-mail.net Cc: tutor@python.org Subject: Re: [Tutor] dictionaries help Date: Thu, 23 Jul 2009 21:44:33 -0400 > On Thu, Jul 23, 2009 at 7:09 PM, wrote: > > Hello again, > > Here is

Re: [Tutor] dictionaries help

2009-07-23 Thread davidwilson
more efficient. Basically I have a big list of industries and I want to verify for each member whether they are active or not active. The industry list of dictionaries will stay fixed at about 25 items, whereas the ws_industry tuple will change depending. I have to go through about 20,000 item

Re: [Tutor] dictionaries help

2009-07-23 Thread davidwilson
thank you for all your answers Original Message From: Norman Khine Apparently from: tutor-bounces+davidwilson=safe-mail@python.org To: tutor@python.org Subject: Re: [Tutor] dictionaries help Date: Thu, 23 Jul 2009 21:59:01 +0100 > Also you can use list comprehens

[Tutor] dictionaries help

2009-07-23 Thread davidwilson
hello, please excuse me, but i would like to understand how dictionaris work. for example: >>> my_lst = [{'code': 'aaa', 'name': 'a name'}, {'code': 'bbb', 'name': 'b >>> name'}] >>> my_code = 'aaa' from the above i would like to compare my_code and return the dictionary which has code == my_c