Introduction to Python basics modules classes Python Basics named after Monty Python interpreted dynamically typed object-oriented indentation based.

Slides:



Advertisements
Similar presentations
Exception Handling Genome 559. Review - classes 1) Class constructors - class myClass: def __init__(self, arg1, arg2): self.var1 = arg1 self.var2 = arg2.
Advertisements

Lecture 04 – Classes.  Python has a number of classes built-in  lists, dictionaries, sets, int, float, boolean, strings  We can define our own classes.
Project 1 Introduction to HTML.
CS 142 Lecture Notes: HTMLSlide 1 Introduction There are several good reasons for taking CS142: Web Applications: ● You will learn a variety of interesting.
 2002 Prentice Hall. All rights reserved. 1 Chapter 6 – Introduction to the Common Gateway Interface (CGI) Outline 6.1 Introduction 6.2 Client and Web.
F DIGITAL MEDIA: COMMUNICATION AND DESIGN INTRODUCTION TO XML AND XHTML.
Introduction to XHTML Professor Stephen Kwan. 2 XHTML HTML StyleSheets XML CascadingStyleSheets(CSS) ExtensibleStylesheetLanguage(XSL) StructureFormatContent.
1 Outline 7.1 Introduction 7.2 Implementing a Time Abstract Data Type with a Class 7.3 Special Attributes 7.4Controlling Access to Attributes 7.4.1Get.
Introduction to Python. What is Python? Interpreted object oriented high level programming language – No compiling or linking neccesary Extensible: add.
1st Project Introduction to HTML.
HTML 1 Introduction to HTML. 2 Objectives Describe the Internet and its associated key terms Describe the World Wide Web and its associated key terms.
Chapter ONE Introduction to HTML.
PHP (Hypertext Preprocessor) 1. PHP References From W3 Schools: PHP.
HTML & XHTML Introduction. First HTML 1992 Marked-up text to represent a hypertext document for transmission over the network The hypertext mark-up language.
August Chapter 1 - Introduction Learning XML by Erik T. Ray Slides were developed by Jack Davis College of Information Science and Technology Radford.
Centre for Computer Technology ICT115 Object Oriented Design and Programming Week 2 Intro to Classes Richard Salomon and Umesh Patel Centre for Information.
 XHTML is aimed to replace HTML  XHTML is almost identical to HTML 4.01  XHTML is a stricter and cleaner version of HTML  XHTML is HTML defined as.
XHTML and Forms Review – Page 1CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: Review XHTML and Forms.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 2 Key Concepts 1 Copyright © Terry Felke-Morris.
Introduction. Document Structure Overview  XML declaration (prolog)  Document type declaration  Root element (namespace)  Document header  Document.
3 XHTML.
1 Web Developer Foundations: Using XHTML Chapter 2 Key Concepts.
Exploring the Power of Page Layouts in SharePoint 2010 WCM Sites John Ross & Randy Drisgill SharePoint MVPs Rackspace Hosting OSP335.
1 Web Development Lecture # 11 Introduction to XHTML (Chapter # 4) It.GulGasht.Com.
HTML PROJECT #1 Project 1 Introduction to HTML HTML Project 1: Introduction to HTML 2 Vocabulary Internet service provider (ISP) A company that has a.
An Introduction to Python Blake Brogdon. What is Python?  Python is an interpreted, interactive, object-oriented programming language. (from python.org)
CSC 508 – Theory of Programming Languages, Spring, 2009 Week 3: Data Abstraction and Object Orientation.
Frames in XHTML Please use speaker notes for additional information!
XHTML1-1 Extensible HyperText Markup Language (XHTML) Part 2 Xingquan (Hill) Zhu
Lesson 4.
Classes 1 COMPSCI 105 S Principles of Computer Science.
Web Page Design Introduction. The ________________ is a large collection of pages stored on computers, or ______________ around the world. Hypertext ________.
Chapter 10: JavaScript Functions CIS 275—Web Application Development for Business I.
Copyright © 2003 Pearson Education, Inc. Slide 1-1 Created by Cheryl M. Hughes The Web Wizard’s Guide to XHTML by Cheryl M. Hughes.
Object-Oriented Programming © 2013 Goodrich, Tamassia, Goldwasser1Object-Oriented Programming.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
CIS 375—Web App Dev II JavaScript I. 2 Introduction to DTD JavaScript is a scripting language developed by ________. A scripting language is a lightweight.
HTML Concepts and Techniques Fifth Edition Chapter 1 Introduction to HTML.
XP Tutorial 9New Perspectives on HTML and XHTML, Comprehensive 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing a Line of Text in a Web Page 7.3 Another JavaScript.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
ASP.NET – Active Server Pages ASP.NET is a server-side technology for developing web applications based on the.NET Framework.
XP 2 HTML Tutorial 1: Developing a Basic Web Page.
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
CIS 228 The Internet 9/20/11 XHTML 1.0. “Quirks” Mode Today, all browsers support standards Compliant pages are displayed similarly There are multiple.
INT222 – Internet Fundamentals
LECTURE 2 Python Basics. MODULES So, we just put together our first real Python program. Let’s say we store this program in a file called fib.py. We have.
Glencoe Introduction to Web Design Chapter 4 XHTML Basics 1 Review Do you remember the vocabulary terms from this chapter? Use the following slides to.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
Web Page Programming Terms. Chapter 1 Objectives Describe Internet and Understand Key terms Describe World Wide Web and its Key terms Identify types and.
HTML PROJECT #1 Project 1 Introduction to HTML. HTML Project 1: Introduction to HTML 2 Project Objectives 1.Describe the Internet and its associated key.
Mark-up Languages Compare and describe at least 3 mark-up languages and what they do.
Extensible Markup Language (XML) Pat Morin COMP 2405.
Project 1 Introduction to HTML.
CIS 228 The Internet 9/20/11 XHTML 1.0.
Chapter 1 Introduction to HTML.
Florida Gulf Coast University
W3C Web standards and Recommendations
Project 1 Introduction to HTML.
Web Development & Design Foundations with HTML5 8th Edition
Python’s Modules by E. Esin GOKGOZ.
Markup Languages Gilok Choi 9/17/2018
HTML A brief introduction HTML.
Introduction There are several good reasons for taking CS142: Web Applications: You will learn a variety of interesting concepts. It may inspire you to.
An Introduction to Python
Structuring Content in a Web Document
HTML Structure.
Intro to PHP.
Web Design & Development
Creating Web Documents
Presentation transcript:

Introduction to Python basics modules classes

Python Basics named after Monty Python interpreted dynamically typed object-oriented indentation based statement grouping (!)‏

def fib(n): # write Fibonacci series up to n """Print a Fibonacci series up to n.""" a, b = 0, 1 while b < n: print b, a, b = b, a+b

Python Modules a file containing class and function definitions and executable statements modules can be executed directly modules can be imported into other modules

import BaseHTTPServer class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):... def test(HandlerClass = SimpleHTTPRequestHandler, ServerClass = BaseHTTPServer.HTTPServer): BaseHTTPServer.test(HandlerClass, ServerClass)‏ if __name__ == '__main__': test()‏ SimpleHTTPServer.py

Executing Modules Directly e.g. H:\> python SimpleHTTPServer.py class and function definitions are entered into the ' __main__ ' symbol table executable statements are executed

Importing Modules e.g. import SimpleHTTPServer a new symbol table is created with the name of the module class and function definitions are entered into the newly created symbol table executable statements are executed only if this is the first time the module has been imported

Accessing Imported Symbols imported functions and classes are accessed by prefixing the function or class name with the name of the module e.g. import SimpleHTTPServer... SimpleHTTPServer.test

Python Classes all members (data and methods) are public all methods are virtual the first (explicit) argument of a method is the object itself; this argument is implied when the method is called special object initialization goes in the ' __init__ ' method classes are first class data types

import SocketServer class HTTPServer(SocketServer.TCPServer): def server_bind(self): """Override server_bind to store the server name.""" SocketServer.TCPServer.server_bind(self)‏ host, port = self.socket.getsockname()‏ self.server_name = socket.getfqdn(host)‏ self.server_port = port BaseHTTPServer.py

import socket class BaseServer:... class TCPServer(BaseServer): def __init__(self, server_address, RequestHandlerClass): """Constructor. May be extended, do not override.""" BaseServer.__init__(self, server_address, RequestHandlerClass)‏ self.socket = socket.socket(self.address_family, self.socket_type)‏ self.server_bind()‏ self.server_activate()‏ SocketServer.py

XHTML reformulation of HTML in XML XML (eXtensible Markup Language)‏  adds structure and meaning to content  hierarchy delineated by tags

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " Foo foo