-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateProject.py
More file actions
49 lines (43 loc) · 1.04 KB
/
CreateProject.py
File metadata and controls
49 lines (43 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import os, datetime, pathlib
name = input('Enter your project name...\n>>>')
desktop = pathlib.Path.home() / 'Desktop'
date = os.path.join(desktop, datetime.date.today().strftime('%d-%b-%y'))
name = os.path.join(date, name)
os.makedirs(date)
os.makedirs(name)
html = name+'\\index.html'
css = name+'\\style.css'
js = name+'\\script.js'
with open(html, 'w') as f:
f.write(f"""<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="main">
</div>
<script src="script.js"></script>
</body>
</html>
""")
with open(css, 'x') as s:
s.write("""* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.main {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
background-color: cornsilk;
}
""")
a = open(js, 'x')
os.system('code '+'"'+name+'"')