2010-02-01から1ヶ月間の記事一覧

count number of character

Using empty list and it creates an index. If character exists, dictionary will be updated by number. st = 'aaavbbaa' lis = [] di = {} for i in st: if i not in lis: lis.append(i) di[i]=1 else: di[i]+=1 >>>di {'a': 5, 'b': 2, 'v': 1}

PIL and to use ImageFont module

PIL is flexibility and useful library about image file. I tried to use it. Install is complete but can not use ImageFont module. Display error,"ImportError: The _imagingft C module is not installed"It happened, module doesn't exist. I goog…

Reserve

a = [1,2,3,4] b = [] c = 1 le = len(a) for i in range(le): b.append(a[le - c]): c = c + 1