Advertisement
here2share

# dotdotdot.py

May 26th, 2020
1,441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. # dotdotdot.py
  4.  
  5. zzz = '''
  6. ...
  7. '''.splitlines()
  8.  
  9. import tempfile
  10. import webbrowser
  11.  
  12. try:
  13.     # Python2
  14.     from Tkinter import *
  15.     from urllib2 import urlopen
  16. except ImportError:
  17.     # Python3
  18.     from tkinter import *
  19.     from urllib.request import urlopen
  20.  
  21. zmax=''
  22. srcfilename=tempfile.mktemp(".html", "demo_")
  23. web="""<!DOCTYPE html><b>@"""
  24.  
  25. ppp = []
  26.  
  27. p = '. '
  28. dots = '.'*60
  29. for z in zzz:
  30.     if p in z:
  31.         r = 0
  32.         z = z.split(p)
  33.         t = z[0]+' .'
  34.         if ord(max(list(t))) > 127:
  35.             r = 3
  36.         t = t+dots
  37.         t = t.replace('+', ' + ').replace('  ', ' ')
  38.         z = t[:40+r]+' '+z[-1][0].upper()+z[-1][1:]
  39.         z = z.replace('. .', '...')
  40.     ppp.append(z)
  41. 0
  42.  
  43. links='<br>'.join(ppp)
  44. temp=open(srcfilename, 'w')
  45. temp.write(web.replace('@',links))
  46. temp.close()
  47. webbrowser.open_new_tab(srcfilename)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement