Try this:
>>> def f(mystring):
charlist = list(mystring)
tmplist = [ [''] ]
for a in charlist:
if tmplist[-1][-1] == '/' or a == '/':
tmplist[-1].append(a)
else:
tmplist.append( [a] )
return [''.join(a) for a in tmplist][1:]
>>> #Thusly:
Hello List,
Does anyone know of a way simple way to display JPG and PNG images on python 3?
My program uses tkinter, and currently my solution is to use ImageMagick's
convert through std to convert the images to gif. However the conversion is too
time consuming.
I have only started using pytho
When there are no more references to an open file object, will it close, or the
file will just remain open, forever unreachable?
Découvrez les styles qui font sensation sur Yahoo! Québec Avatars.
http://cf.avatars.yahoo.com/___
Tutor maillist
#Here's my try:
vowel_killer_dict = { ord(a): None for a in 'aeiou'}
def devocalize(word):
return word.translate(vowel_killer_dict)
vowelled = ['him', 'ham', 'hum', 'fun', 'fan']
vowelled = set(vowelled)
devocalise_dict={}
for a in vowelled:
devocalise_dict[a]= devocalize(a)
un
Hi folks,
I'm trying to do something like this:
>>> evildict= {'good' : 'bad' , 'love' : 'hate' , 'God': 'Satan'}
>>> def make_evil(text)
... for a in evildict:
... text=text.replace(a, evildict[a])
... return text
This works fine, but it soon gets too slow
If you just want to load the data into python one time, rather than connecting
to the file, it would be more handy to paste the cells from the clipboard.
Here's how I do it on windows:
from win32clipboard import * #("pywin32" module required)
def pastetable(): OpenClipboard() try: a=GetCli
I wanted to display a counter for my loops like this:
>>> for a in range(int(1e+307)):... a=str(a)... b='\b'*len(a)...
>>> print(b,a, sep='',end='')
But this only works on the command prompt, in IDLE it will flood the screen.
How do I do it?
Découvrez les photos les plus i