Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 14th, 2012  |  syntax: None  |  size: 0.38 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Dealing with the Tkinter Text Widgets Indexing System.
  2. index = '140.2020'
  3.  
  4. split = index.split('.')
  5.  
  6. nindex = [int(i) for i in split]
  7.  
  8. print nindex
  9.        
  10. int(index.split('.')[-1])
  11.        
  12. int(str(index).split('.')[-1])
  13.        
  14. def after_period(number):
  15.     return int(str(number).partition(".")[2])
  16.        
  17. for num in [1.24345, 1455.24]:  
  18.     whole, dec = divmod(num, 1)  
  19.     print num, whole, dec