생활코딩

Coding Everybody

코스 전체목록

닫기

활용 - 생성 구현 2 - 전송한 정보의 처리

수업소개

html form을 이용해서 전송한 데이터를 Python 애플리케이션이 받아서 처리하는 방법을 소개합니다. 

 

 

강의

 

 

 

소스코드

process_create.py

#!/usr/local/bin/python3

import cgi
form = cgi.FieldStorage()
title = form["title"].value
description = form['description'].value

opened_file = open('data/'+title, 'w')
opened_file.write(description)
opened_file.close()

#Redirection
print("Location: index.py?id="+title)
print()

 

댓글

댓글 본문
버전 관리
egoing
현재 버전
선택 버전
graphittie 자세히 보기