Python how to extract all ID names and CLASS names from css files
扔个三星炸死你
扔个三星炸死你 2017-07-05 10:35:41
0
1
1207

There is a requirement to extract all ID names and CLASS names from the css file into two lists

Can this function be accurately implemented using regular expressions?

classValues = re.findall(r'\.([\w_-]+)',content) 

idValues = re.findall(r'#([\w_-]+)',content) 

But there will be many more values ​​that do not belong to ID and class, such as the following situation:

background-color: #fff; 
-webkit-box-shadow: 0 0 2px 0 rgba(31, 31, 31, 0.07);
扔个三星炸死你
扔个三星炸死你

reply all(1)
代言
re.findall('\.(.+){', content) 
re.findall('#(.+){', content)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template