CSS file Format Script method

Source: Internet
Author: User
This time to bring you a CSS file format script method, CSS file format script considerations are what, the following is the actual case, take a look.

#!/usr/bin/python#-*-coding:utf-8-*-import sys,osdef format (DDT):   DDT = ddt.replace (' \ n ', ') #去除换行   ddt= Ddt.replace (';} ', '} '). replace ('; ', '; \ n '). Replace (' {', ' {\ n '). Replace ('} ', ' \n}\n ') #重新换行   lines = ddt.split ("\ n" ) #读取全部换行内容   ddt= "for line in   lines  :       ddt=ddt+line.strip (") + "\ n" #去除每行前面空格   return Ddt.replace ( ' {\ n ', ' {\ n    '). replace ('; \ n ', '; \ n    ') #空格整理for file in sys.argv:   if file!=sys.argv[0] and Os.path.isfile ( file) and  (str (file). Split (".") [-1]). Lower () = = "CSS":      print U "Reading-", file      newfile = open (file, "R")      F=format (Newfile.read ())      NewFile =open (file, ' W ')      newfile.write (f)      newfile.close ()      print file, "-ok"

Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!

Related reading:

Different versions of Vscdoe how to debug different versions Nodejs

Vuejs WEBP support for Image plugin development

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.