Advertisement
Guest User

Damn you python

a guest
Sep 24th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2.  
  3. ######
  4. # Lyend
  5.  
  6. #Get current directory
  7. current = os.path.dirname(os.path.realpath(__file__))
  8.  
  9. #open Template
  10. file = open(current+'/template/red.css', 'r') #Css example here : http://pastebin.com/tS8pAwMF
  11.  
  12. #Lets try not to kill memory consumption
  13. contents = file.read(1024)
  14. file.close()
  15.  
  16. print(contents + "\n\n")
  17.  
  18. def getNames():
  19.     global i
  20.     i = 0
  21.     print('Element Names: ')
  22.     #Grab all the element names from template, I dunno even know how I did this and it worked so goddamn well lmao
  23.     for elementName in contents.split("}"):
  24.         element_split = elementName.split("{")
  25.  
  26.         #turn the list into a string, and get rid of extra padding
  27.         elements = str(element_split[0].replace('\n', ''))
  28.         #print(elements)
  29.  
  30.         #get the styles for each element
  31.         elementStyle = str(element_split[1:2])
  32.     print(elements) #Just need to separate this into variables
  33.         #print(elementStyle)
  34.  
  35.     print('\n\n'+elements) #Woah, returns nothing.
  36.  
  37. getNames()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement