Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # dotdotdot.py
- zzz = '''
- ...
- '''.splitlines()
- import tempfile
- import webbrowser
- try:
- # Python2
- from Tkinter import *
- from urllib2 import urlopen
- except ImportError:
- # Python3
- from tkinter import *
- from urllib.request import urlopen
- zmax=''
- srcfilename=tempfile.mktemp(".html", "demo_")
- web="""<!DOCTYPE html><b>@"""
- ppp = []
- p = '. '
- dots = '.'*60
- for z in zzz:
- if p in z:
- r = 0
- z = z.split(p)
- t = z[0]+' .'
- if ord(max(list(t))) > 127:
- r = 3
- t = t+dots
- t = t.replace('+', ' + ').replace(' ', ' ')
- z = t[:40+r]+' '+z[-1][0].upper()+z[-1][1:]
- z = z.replace('. .', '...')
- ppp.append(z)
- 0
- links='<br>'.join(ppp)
- temp=open(srcfilename, 'w')
- temp.write(web.replace('@',links))
- temp.close()
- webbrowser.open_new_tab(srcfilename)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement