Skip to content

Commit

Permalink
파일로부터 데이터 읽기
Browse files Browse the repository at this point in the history
  • Loading branch information
egoing committed Mar 14, 2018
1 parent 01d5599 commit 4f3b0fc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions data/CSS
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
CSS is Lorem ipsum dolor sit amet, consectetur adipisicing elit. Similique delectus ipsam, vel? Obcaecati natus quod dolores aliquam reprehenderit omnis, quae dolore totam nisi, ab sapiente nulla corporis delectus maiores vel.
1 change: 1 addition & 0 deletions data/HTML
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
HTML is Lorem ipsum dolor sit amet, consectetur adipisicing elit. Impedit perferendis corporis dolorum modi cum incidunt quo aliquid nesciunt excepturi explicabo, sunt, et non in sed. Molestias id culpa non ipsum.
1 change: 1 addition & 0 deletions data/JavaScript
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
JavaScript is Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
1 change: 1 addition & 0 deletions data/Python
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
Python is Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
8 changes: 5 additions & 3 deletions index.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
form = cgi.FieldStorage() form = cgi.FieldStorage()
if 'id' in form: if 'id' in form:
pageId = form["id"].value pageId = form["id"].value
description = open('data/'+pageId, 'r').read()
else: else:
pageId = 'Welcome' pageId = 'Welcome'
description = 'Hello, web'
print('''<!doctype html> print('''<!doctype html>
<html> <html>
<head> <head>
Expand All @@ -19,10 +21,10 @@
<li><a href="index.py?id=HTML">HTML</a></li> <li><a href="index.py?id=HTML">HTML</a></li>
<li><a href="index.py?id=CSS">CSS</a></li> <li><a href="index.py?id=CSS">CSS</a></li>
<li><a href="index.py?id=JavaScript">JavaScript</a></li> <li><a href="index.py?id=JavaScript">JavaScript</a></li>
<li><a href="index.py?id=Python">Python</a></li>
</ol> </ol>
<h2>{title}</h2> <h2>{title}</h2>
<p>The World Wide Web (abbreviated WWW or the Web) is an information space where documents and other web resources are identified by Uniform Resource Locators (URLs), interlinked by hypertext links, and can be accessed via the Internet.[1] English scientist Tim Berners-Lee invented the World Wide Web in 1989. He wrote the first web browser computer program in 1990 while employed at CERN in Switzerland.[2][3] The Web browser was released outside of CERN in 1991, first to other research institutions starting in January 1991 and to the general public on the Internet in August 1991. <p>{desc}</p>
</p>
</body> </body>
</html> </html>
'''.format(title=pageId)) '''.format(title=pageId, desc=description))

0 comments on commit 4f3b0fc

Please sign in to comment.