Skip to content

Commit

Permalink
Python Tools
Browse files Browse the repository at this point in the history
  • Loading branch information
linrakesh committed Jan 22, 2020
1 parent 6d2c566 commit 21af134
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Tools/css_beautifier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from yattag import indent
with open("E:/python/Tools/style.css", "r") as file:
data = file.read()

result = indent(
data,
indentation=' ',
newline='\r\n',
indent_text=True
)
print(result)
15 changes: 15 additions & 0 deletions Tools/csv_to_pdf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# program to convert CSV file into PDF file
from fpdf import FPDF
import csv

with open("e:/python/tools/SampleData.csv", "r") as csv_file:
data = csv.reader(csv_file)
for row in data:
print(row)


pdf = FPDF(orientation='P', unit='mm', format='A4') # P -potrait L-Landscape
pdf.add_page()
pdf.set_font("Arial", size=12)
pdf.cell(200, 10, txt=str(data), ln=1, align="C")
pdf.output("simple_demo.pdf")
11 changes: 11 additions & 0 deletions Tools/html_beautifier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from yattag import indent
with open("E:/python/Tools/index.html", "r") as file:
data = file.read()

result = indent(
data,
indentation=' ',
newline='\r\n',
indent_text=True
)
print(result)
2 changes: 2 additions & 0 deletions Tools/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.underline {position: relative; margin-bottom:30px;}
.underline::after{ display: block; content: ''; width: 50px; height: 1px; background: #F27316; position: absolute;bottom: -15px;left: 0%;margin-bottom: ;}
21 changes: 21 additions & 0 deletions Tools/tempCodeRunnerFile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# python program to convert any csv file into html file
# made by : rakesh kumar

import csv
html = "<table>"
with open("E:/python/Tools/SampleData.csv") as csv_file:
csv_data = csv.reader(csv_file)
count = 1
for row in csv_data:
html += "<tr>"
if count == 1:
for y in row:
html += "<th>"+y+"</th>"
else:
for y in row:
html += "<td>"+y+"</td>"
html += "</tr>"
count += 1

html += "</table>"
print(html)
10 changes: 9 additions & 1 deletion Tools/xml_beatifier.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
from yattag import indent
with open("E:/python/Tools/sample.xml", "r") as file:
data = file.read()
print(data)

result = indent(
data,
indentation=' ',
newline='\r\n',
indent_text=True
)
print(result)

0 comments on commit 21af134

Please sign in to comment.