On Apr 3, 12:26 pm, Alain Ketterlin
wrote:
> nn writes:
> >> > for item in tag23gr:
> >> > ... value, key = tuple(item)
> >> > ... if(g23tag.get(key)):
> >> > ... g23tag[key].append(value)
> >> > ... else:
> >> > ... g23tag[key] = [value]
>
> >>
nn writes:
>> > for item in tag23gr:
>> > ... value, key = tuple(item)
>> > ... if(g23tag.get(key)):
>> > ... g23tag[key].append(value)
>> > ... else:
>> > ... g23tag[key] = [value]
>>
>> for item in tag23gr:
>> g23tag.setdefault(item[0],[]).
On Apr 3, 11:02 am, Alain Ketterlin
wrote:
> python writes:
> > tag23gr is a list of lists each with two items.
> > g23tag is an empty dictionary when I run the for loop below.
> > When is is complete each key is a graphic name who's values are a list
> > of tags.
>
> > for item in tag23gr:
> > .
python wrote:
> I played around with a few things and this works but was wondering if
> there was a better way to do this.
> My first thought was list comprehension but could not get a figure out
> the syntax.
>
> tag23gr is a list of lists each with two items.
> g23tag is an empty dictionary whe
On Wed, Apr 4, 2012 at 12:36 AM, python wrote:
> for item in tag23gr:
> ... value, key = tuple(item)
> ... if(g23tag.get(key)):
> ... g23tag[key].append(value)
> ... else:
> ... g23tag[key] = [value]
Simple enhancement: Use setdefault. Instead of the if, just u
python writes:
> tag23gr is a list of lists each with two items.
> g23tag is an empty dictionary when I run the for loop below.
> When is is complete each key is a graphic name who's values are a list
> of tags.
>
> for item in tag23gr:
> ... value, key = tuple(item)
> ... if(g23tag.get(key))
I played around with a few things and this works but was wondering if
there was a better way to do this.
My first thought was list comprehension but could not get a figure out
the syntax.
tag23gr is a list of lists each with two items.
g23tag is an empty dictionary when I run the for loop below.
W
"Matt Mitchell" wrote in message
news:mailman.65.1267464765.23598.python-l...@python.org...
> My initial idea was to make a list of all the different
> ways "project" has been capitalized in my repo and try each one. The
> code looks like this:
I would use pysvn.Client.list to get a list of fi
Hi,
I wrote a python script that uses pysvn to export projects from an svn
repo I have. The repo has hundreds of projects in it with a directory
structure that is pretty uniform however it's not exactly uniform
because of the capitalization. I.e.:
\root
\project English
\Stuff
\Stu
On Feb 24, 6:29 am, "Rhodri James"
wrote:
> On Mon, 23 Feb 2009 23:33:31 -, Gary Wood wrote:
> > '''exercise to complete and test this function'''
> > import string
> > def joinStrings(items):
> > '''Join all the strings in stringList into one string,
> > and return the result. For ex
On Mon, 23 Feb 2009 23:33:31 -, Gary Wood wrote:
'''exercise to complete and test this function'''
import string
def joinStrings(items):
'''Join all the strings in stringList into one string,
and return the result. For example:
>>> print joinStrings(['very', 'hot', 'day'])
'
'''exercise to complete and test this function'''
import string
def joinStrings(items):
'''Join all the strings in stringList into one string,
and return the result. For example:
>>> print joinStrings(['very', 'hot', 'day'])
'veryhotday'
'''
for i in items:
return (''
I had a software package screw up a directory tree by placing all the
files in a directory of the same name. So I wound up with:
Root
file1.txt (dir)
file1.txt (file)
file2.txt (dir)
file2.txt (file)
Annoying. So I wrote the following script, which fixed the problem by
renaming a
13 matches
Mail list logo