The document introduces Python programming language. It provides an overview of Python's history and key features such as being an interpreted, object-oriented, and platform independent language. It also discusses Python syntax including data types, variables, input/output, operators, conditional statements, loops, functions, and data structures like lists, tuples, dictionaries. Several examples are given to illustrate different Python concepts and syntax.
Python легко и просто. Красиво решаем повседневные задачиMaxim Kulsha
The document discusses various techniques for iteration in Python. It covers iterating over lists, dictionaries, files and more. It provides examples of iterating properly to avoid errors like modifying a list during iteration. Context managers are also discussed as a clean way to handle resources like file objects. Overall the document shares best practices for writing efficient and robust iteration code in Python.
The document discusses various Python data structures and modules for working with data structures efficiently. It covers the abc module for defining abstract base classes, the array module for efficient storage of homogeneous data, the bisect module for working with sorted lists, the collections module which provides high-performance container data types like deque and defaultdict, namedtuple for creating tuple subclasses with named fields, heapq for priority queue implementation, and itertools for functions generating efficient iterators.
This document provides an overview of Python fundamentals including basic concepts like data types, operators, flow control, functions and classes. It begins with an introduction to Python versions and environments. The outline covers topics like Hello World, common types and operators for numeric, string and container data types. It also discusses flow control structures like if/else, while loops and for loops. Finally, it briefly mentions functions, classes, exceptions and file I/O.
Built-in functions in Python include common math functions like abs() and pow(), type-checking functions like isinstance(), string functions like ord() and format(), container functions like list() and tuple(), and IO functions like open() and print(). Some functions return new values like bin() while others operate iteratively like map() or filter() sequences. Many built-ins help with common programming tasks to make code more concise and Pythonic.
발표자: 김준호(Lunit)
발표일: 2018.1.
의료 AI 관련 중, nodule detection 문제에 대해 다뤄보고자 합니다.
의료 AI에서는 어떠한 방식으로 classication을 하고, preprocessing은 어떤식으로 진행되는지 LUNA16이라는 의료 challenge에 이용되는 데이터를 가지고 발표를 진행해보고자 합니다.
이후, 이 데이터를 이용해서 최근 2017 MICCAI (의료 영상학회에서는 높은 수준의 학회)에서 발표된 "curriculum adaptive sampling for extreme data imbalance"를 실제 구현해서 적용해보고 이 때 발생할 수 있는 문제를 어떤식으로 해결할 수 있는지에 대한 tip도 제공할 예정입니다. (Python multi-processing data load, input-pipeline)
위 논문을 선정한 이유는, 단순한 classification이 아닌, nodule이 있는 위치도 정확하게 catch하는 논문 중, performance가 상당히 높기 때문입니다.
This document provides an introduction to the Go programming language. It discusses why Go was created, its key features like performance, concurrency and productivity. It provides examples of basic Go programs and explains basic language concepts like types, functions, interfaces and methods. The document also discusses the history and creators of the Go language.
This document provides examples of Python code snippets covering various topics like Python basics (print, variables, data types), conditional statements (if-else), loops (for, while), functions, object oriented programming (classes, inheritance), file handling, modules, database connectivity (MySQL, Redis), XML/HTML parsing and web scraping. It also shows code for installing and importing various third party Python libraries and modules.
Python легко и просто. Красиво решаем повседневные задачиMaxim Kulsha
The document discusses various techniques for iteration in Python. It covers iterating over lists, dictionaries, files and more. It provides examples of iterating properly to avoid errors like modifying a list during iteration. Context managers are also discussed as a clean way to handle resources like file objects. Overall the document shares best practices for writing efficient and robust iteration code in Python.
The document discusses various Python data structures and modules for working with data structures efficiently. It covers the abc module for defining abstract base classes, the array module for efficient storage of homogeneous data, the bisect module for working with sorted lists, the collections module which provides high-performance container data types like deque and defaultdict, namedtuple for creating tuple subclasses with named fields, heapq for priority queue implementation, and itertools for functions generating efficient iterators.
This document provides an overview of Python fundamentals including basic concepts like data types, operators, flow control, functions and classes. It begins with an introduction to Python versions and environments. The outline covers topics like Hello World, common types and operators for numeric, string and container data types. It also discusses flow control structures like if/else, while loops and for loops. Finally, it briefly mentions functions, classes, exceptions and file I/O.
Built-in functions in Python include common math functions like abs() and pow(), type-checking functions like isinstance(), string functions like ord() and format(), container functions like list() and tuple(), and IO functions like open() and print(). Some functions return new values like bin() while others operate iteratively like map() or filter() sequences. Many built-ins help with common programming tasks to make code more concise and Pythonic.
발표자: 김준호(Lunit)
발표일: 2018.1.
의료 AI 관련 중, nodule detection 문제에 대해 다뤄보고자 합니다.
의료 AI에서는 어떠한 방식으로 classication을 하고, preprocessing은 어떤식으로 진행되는지 LUNA16이라는 의료 challenge에 이용되는 데이터를 가지고 발표를 진행해보고자 합니다.
이후, 이 데이터를 이용해서 최근 2017 MICCAI (의료 영상학회에서는 높은 수준의 학회)에서 발표된 "curriculum adaptive sampling for extreme data imbalance"를 실제 구현해서 적용해보고 이 때 발생할 수 있는 문제를 어떤식으로 해결할 수 있는지에 대한 tip도 제공할 예정입니다. (Python multi-processing data load, input-pipeline)
위 논문을 선정한 이유는, 단순한 classification이 아닌, nodule이 있는 위치도 정확하게 catch하는 논문 중, performance가 상당히 높기 때문입니다.
This document provides an introduction to the Go programming language. It discusses why Go was created, its key features like performance, concurrency and productivity. It provides examples of basic Go programs and explains basic language concepts like types, functions, interfaces and methods. The document also discusses the history and creators of the Go language.
This document provides examples of Python code snippets covering various topics like Python basics (print, variables, data types), conditional statements (if-else), loops (for, while), functions, object oriented programming (classes, inheritance), file handling, modules, database connectivity (MySQL, Redis), XML/HTML parsing and web scraping. It also shows code for installing and importing various third party Python libraries and modules.
This document discusses various Python functions concepts including defining simple functions, functions with arguments, default arguments, lambda functions, generators, and decorators. It provides examples of defining functions that take positional and keyword arguments, using lambda functions, creating generators using yield, and applying decorators to functions. Various introspection methods like type(), dir(), and callable() are also covered.
This document provides an overview of types in Go compared to Ruby. Some key points:
- Go uses static, struct-based types while Ruby uses dynamic, class-based types.
- In Go, types are defined with the type keyword and methods are defined on specific types. In Ruby, classes define types and inheritance.
- Go types are static and checked at compile-time. Ruby types are dynamic and can change at runtime.
- Go uses interfaces to define common method sets. Ruby uses mixins and inheritance for polymorphism.
The document provides examples of defining types and methods in Go, and uses classes and inheritance in Ruby. It discusses how Go prioritizes static types while Ruby
The document discusses Python functions. Some key points covered include:
- Functions are reusable blocks of code defined using the def keyword that can accept parameters and return values.
- To execute a function, it must be called by name with appropriate arguments.
- Functions can call themselves, which is known as recursion.
- Functions can have default, variable, and keyword parameters to provide flexibility in how they are called.
This document provides examples of built-in functions and decorators in Python like map, filter, all, any, getattr, hasattr, setattr, callable, isinstance, issubclass, closures, and memoization decorators. It demonstrates how to use these functions and decorators through examples. Built-in functions like map, filter and decorators allow extending functionality of functions. Closures enable functions to remember values in enclosing scopes. The @decorator syntax is demonstrated to be equivalent to applying a function to another function.
The document discusses Python generators and how they can be used for iterating over lists, tuples, dictionaries, strings, files and custom iterable objects. It provides examples of using generators and the yield keyword to iterate over a countdown and generate values. The document also discusses two problems - analyzing log files using generators and finding files matching patterns using the os.walk generator.
Introduction to ad-3.4, an automatic differentiation library in Haskellnebuta
Haskellの自動微分ライブラリ Ad-3.4 の紹介(の試み) If you don't see 21 slides in this presentation, try this one (re-uploaded): http://www.slideshare.net/nebuta/130329-ad-by-ekmett
Here are the steps to solve this problem:
1. Convert both lists of numbers to sets:
set1 = {11, 2, 3, 4, 15, 6, 7, 8, 9, 10}
set2 = {15, 2, 3, 4, 15, 6}
2. Find the intersection of the two sets:
intersection = set1.intersection(set2)
3. The number of elements in the intersection is the number of similar elements:
similarity = len(intersection)
4. Print the result:
print(similarity)
The similarity between the two sets is 4, since they both contain the elements {2, 3, 4, 15}.
From java to kotlin beyond alt+shift+cmd+k - Droidcon italyFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay!
Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write.
In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf MilanFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay!
Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write.
In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
The document introduces the Python programming language. It discusses Python's interpretor, data types like integers and strings, control structures like if/else statements and for loops, functions, classes, libraries, and input/output. It provides examples of key Python concepts like boolean logic, lists, dictionaries, regular expressions, and socket programming.
This presentation covers Python most important data structures like Lists, Dictionaries, Sets and Tuples. Exception Handling and Random number generation using simple python module "random" also covered. Added simple python programs at the end of the presentation
Elixir is a functional programming language that is well-suited for building scalable and fault-tolerant applications. The document provides an introduction to Elixir by discussing its roots in Erlang and how it builds upon Erlang's strengths like concurrency, distribution, and fault tolerance. It also demonstrates some basic Elixir concepts like functions, pattern matching, recursion, and the BEAM virtual machine. Finally, it provides examples of real-world applications of Elixir like building Phoenix web applications and developing embedded hardware projects with Nerves.
A spreadsheet error in a 2010 research paper by Carmen Reinhart and Kenneth Rogoff undermined their conclusion that high debt-to-GDP ratios correlate with lower economic growth. Specifically, the paper incorrectly excluded several countries with debt over 90% GDP from its analysis, weakening the claimed relationship between high debt and slow growth that was influential in policymaking. The error was revealed in 2013 through independent research, demonstrating how easily mistakes can propagate in spreadsheets and the importance of transparent data and methodology.
Presented at the European Bioinformatics Institute (17th March 2017)
We often talk about good code — that we would like to write it, that there isn't enough of it, that it should not be considered an optional attribute of a codebase. We often talk about it but, when it comes to being precise, we don't always agree what constitutes good code, nor do we necessarily share a common view on its value.
Slides from my PyCon 2011 talk, "Exhibition of Atrocity," a confessional of my sins against the Python programming language.
Abstract: http://us.pycon.org/2011/schedule/presentations/138/
Video: http://www.pycon.tv/#/video/49
In which Richard will tell you about some things you should never (probably ever) do to or in Python. Warranties may be voided. The recording of this talk is online at http://www.youtube.com/watch?v=H2yfXnUb1S4
Do not repeat yourself, we teach every fledgling software developer. It makes sense as with growing code redundancy the maintenance cost increase. Simple tools such as functions or loops are a great ways to reduce code redundancy but in our quest to avoid code redundancy we sometimes indulge into complexity. Complex code is also costly to maintain. I will demonstrate, using real-world examples, how one can adopt metaprogramming to minimize code redundancy as well keeping the code simple enough for my mom to understand it.
This document compares and contrasts various features of C++ and Go, including:
- Error handling approaches like exceptions in C++ vs explicit error checking in Go.
- Class/struct definitions and how they compare between the languages.
- Common data structures like vectors, maps, and how they are implemented in each language.
- Benchmark results that show Go outperforming C++ in some cases but C++ performing better in others, depending on optimizations and data structure choices.
- Interfacing Go with C via Cgo and the performance overhead of marshalling between the languages.
- Concurrency primitives available in each language like mutexes, channels, atomics.
This document summarizes the key changes and new features introduced in Python 3, including:
- Strings are now unicode by default and implicit conversions between str and bytes are prohibited.
- Integers are unified under int and long is removed.
- New features like formatted string literals, function annotations, nonlocal and keyword-only arguments, extended iterable unpacking, comprehensions, exception chaining, and yield from.
- New collection abstract base classes and data structures like OrderedDict and Counter.
- Metaclasses can now control class creation and new metaclass like OrderedClass is introduced.
- Under the hood improvements including a new GIL and stable ABI version tagged shared object files.
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...Yashpatel821746
This document contains 14 programming questions in Python with solutions. The questions cover a range of Python topics including file handling, classes and objects, functions, exception handling, matrices, and GUI programming using Tkinter. Tkinter widgets like buttons, checkboxes, canvases, entries, frames, listboxes, menus, radiobuttons, scrollbars are demonstrated. Other concepts covered include lambda functions, filters, dictionaries, lists, path handling functions like split, join, and normath, logging and log file rotation.
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...Yashpatel821746
This document contains 14 programming questions in Python with solutions. The questions cover a range of Python topics including file handling, classes and objects, functions, exception handling, matrices, lambda functions, dictionaries, lists, directories and files, GUI programming with Tkinter, string processing, logging and file rotation.
This document discusses various Python functions concepts including defining simple functions, functions with arguments, default arguments, lambda functions, generators, and decorators. It provides examples of defining functions that take positional and keyword arguments, using lambda functions, creating generators using yield, and applying decorators to functions. Various introspection methods like type(), dir(), and callable() are also covered.
This document provides an overview of types in Go compared to Ruby. Some key points:
- Go uses static, struct-based types while Ruby uses dynamic, class-based types.
- In Go, types are defined with the type keyword and methods are defined on specific types. In Ruby, classes define types and inheritance.
- Go types are static and checked at compile-time. Ruby types are dynamic and can change at runtime.
- Go uses interfaces to define common method sets. Ruby uses mixins and inheritance for polymorphism.
The document provides examples of defining types and methods in Go, and uses classes and inheritance in Ruby. It discusses how Go prioritizes static types while Ruby
The document discusses Python functions. Some key points covered include:
- Functions are reusable blocks of code defined using the def keyword that can accept parameters and return values.
- To execute a function, it must be called by name with appropriate arguments.
- Functions can call themselves, which is known as recursion.
- Functions can have default, variable, and keyword parameters to provide flexibility in how they are called.
This document provides examples of built-in functions and decorators in Python like map, filter, all, any, getattr, hasattr, setattr, callable, isinstance, issubclass, closures, and memoization decorators. It demonstrates how to use these functions and decorators through examples. Built-in functions like map, filter and decorators allow extending functionality of functions. Closures enable functions to remember values in enclosing scopes. The @decorator syntax is demonstrated to be equivalent to applying a function to another function.
The document discusses Python generators and how they can be used for iterating over lists, tuples, dictionaries, strings, files and custom iterable objects. It provides examples of using generators and the yield keyword to iterate over a countdown and generate values. The document also discusses two problems - analyzing log files using generators and finding files matching patterns using the os.walk generator.
Introduction to ad-3.4, an automatic differentiation library in Haskellnebuta
Haskellの自動微分ライブラリ Ad-3.4 の紹介(の試み) If you don't see 21 slides in this presentation, try this one (re-uploaded): http://www.slideshare.net/nebuta/130329-ad-by-ekmett
Here are the steps to solve this problem:
1. Convert both lists of numbers to sets:
set1 = {11, 2, 3, 4, 15, 6, 7, 8, 9, 10}
set2 = {15, 2, 3, 4, 15, 6}
2. Find the intersection of the two sets:
intersection = set1.intersection(set2)
3. The number of elements in the intersection is the number of similar elements:
similarity = len(intersection)
4. Print the result:
print(similarity)
The similarity between the two sets is 4, since they both contain the elements {2, 3, 4, 15}.
From java to kotlin beyond alt+shift+cmd+k - Droidcon italyFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay!
Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write.
In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf MilanFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay!
Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write.
In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
The document introduces the Python programming language. It discusses Python's interpretor, data types like integers and strings, control structures like if/else statements and for loops, functions, classes, libraries, and input/output. It provides examples of key Python concepts like boolean logic, lists, dictionaries, regular expressions, and socket programming.
This presentation covers Python most important data structures like Lists, Dictionaries, Sets and Tuples. Exception Handling and Random number generation using simple python module "random" also covered. Added simple python programs at the end of the presentation
Elixir is a functional programming language that is well-suited for building scalable and fault-tolerant applications. The document provides an introduction to Elixir by discussing its roots in Erlang and how it builds upon Erlang's strengths like concurrency, distribution, and fault tolerance. It also demonstrates some basic Elixir concepts like functions, pattern matching, recursion, and the BEAM virtual machine. Finally, it provides examples of real-world applications of Elixir like building Phoenix web applications and developing embedded hardware projects with Nerves.
A spreadsheet error in a 2010 research paper by Carmen Reinhart and Kenneth Rogoff undermined their conclusion that high debt-to-GDP ratios correlate with lower economic growth. Specifically, the paper incorrectly excluded several countries with debt over 90% GDP from its analysis, weakening the claimed relationship between high debt and slow growth that was influential in policymaking. The error was revealed in 2013 through independent research, demonstrating how easily mistakes can propagate in spreadsheets and the importance of transparent data and methodology.
Presented at the European Bioinformatics Institute (17th March 2017)
We often talk about good code — that we would like to write it, that there isn't enough of it, that it should not be considered an optional attribute of a codebase. We often talk about it but, when it comes to being precise, we don't always agree what constitutes good code, nor do we necessarily share a common view on its value.
Slides from my PyCon 2011 talk, "Exhibition of Atrocity," a confessional of my sins against the Python programming language.
Abstract: http://us.pycon.org/2011/schedule/presentations/138/
Video: http://www.pycon.tv/#/video/49
In which Richard will tell you about some things you should never (probably ever) do to or in Python. Warranties may be voided. The recording of this talk is online at http://www.youtube.com/watch?v=H2yfXnUb1S4
Do not repeat yourself, we teach every fledgling software developer. It makes sense as with growing code redundancy the maintenance cost increase. Simple tools such as functions or loops are a great ways to reduce code redundancy but in our quest to avoid code redundancy we sometimes indulge into complexity. Complex code is also costly to maintain. I will demonstrate, using real-world examples, how one can adopt metaprogramming to minimize code redundancy as well keeping the code simple enough for my mom to understand it.
This document compares and contrasts various features of C++ and Go, including:
- Error handling approaches like exceptions in C++ vs explicit error checking in Go.
- Class/struct definitions and how they compare between the languages.
- Common data structures like vectors, maps, and how they are implemented in each language.
- Benchmark results that show Go outperforming C++ in some cases but C++ performing better in others, depending on optimizations and data structure choices.
- Interfacing Go with C via Cgo and the performance overhead of marshalling between the languages.
- Concurrency primitives available in each language like mutexes, channels, atomics.
This document summarizes the key changes and new features introduced in Python 3, including:
- Strings are now unicode by default and implicit conversions between str and bytes are prohibited.
- Integers are unified under int and long is removed.
- New features like formatted string literals, function annotations, nonlocal and keyword-only arguments, extended iterable unpacking, comprehensions, exception chaining, and yield from.
- New collection abstract base classes and data structures like OrderedDict and Counter.
- Metaclasses can now control class creation and new metaclass like OrderedClass is introduced.
- Under the hood improvements including a new GIL and stable ABI version tagged shared object files.
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...Yashpatel821746
This document contains 14 programming questions in Python with solutions. The questions cover a range of Python topics including file handling, classes and objects, functions, exception handling, matrices, and GUI programming using Tkinter. Tkinter widgets like buttons, checkboxes, canvases, entries, frames, listboxes, menus, radiobuttons, scrollbars are demonstrated. Other concepts covered include lambda functions, filters, dictionaries, lists, path handling functions like split, join, and normath, logging and log file rotation.
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...Yashpatel821746
This document contains 14 programming questions in Python with solutions. The questions cover a range of Python topics including file handling, classes and objects, functions, exception handling, matrices, lambda functions, dictionaries, lists, directories and files, GUI programming with Tkinter, string processing, logging and file rotation.
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...Yashpatel821746
This document contains 14 programming questions in Python with solutions. The questions cover a range of Python topics including file handling, classes and objects, functions, exception handling, matrices, lambda functions, dictionaries, lists, directories and files, GUI programming with Tkinter, string processing, logging and file rotation.
The document provides an introduction to Python programming concepts including indentation rules, documentation, data types, variables, numbers, strings, lists, dictionaries, tuples, files, control structures, functions and modules. It discusses Python syntax and examples for working with different data types, control flow, functions and importing modules.
Python Workshop - Learn Python the Hard WayUtkarsh Sengar
This document provides an introduction to learning Python. It discusses prerequisites for Python, basic Python concepts like variables, data types, operators, conditionals and loops. It also covers functions, files, classes and exceptions handling in Python. The document demonstrates these concepts through examples and exercises learners to practice char frequency counting and Caesar cipher encoding/decoding in Python. It encourages learners to practice more to master the language and provides additional learning resources.
This document provides an introduction to Python programming through a series of code examples organized into sections on topics like setup and installation, variables, functions, strings, and more. The examples demonstrate basic Python syntax and how to work with different data types. Overall, the document serves as a tutorial to teach Python concepts and help new programmers get started with the language.
These are the slides of the second part of this multi-part series, from Learn Python Den Haag meetup group. It covers List comprehensions, Dictionary comprehensions and functions.
Python 101++: Let's Get Down to Business!Paige Bailey
You've started the Codecademy and Coursera courses; you've thumbed through Zed Shaw's "Learn Python the Hard Way"; and now you're itching to see what Python can help you do. This is the workshop for you!
Here's the breakdown: we're going to be taking you on a whirlwind tour of Python's capabilities. By the end of the workshop, you should be able to easily follow any of the widely available Python courses on the internet, and have a grasp on some of the more complex aspects of the language.
Please don't forget to bring your personal laptop!
Audience: This course is aimed at those who already have some basic programming experience, either in Python or in another high level programming language (such as C/C++, Fortran, Java, Ruby, Perl, or Visual Basic). If you're an absolute beginner -- new to Python, and new to programming in general -- make sure to check out the "Python 101" workshop!
Python is a versatile, object-oriented programming language that can be used for web development, data analysis, and more. It has a simple syntax and is easy to read and learn. Key features include being interpreted, dynamically typed, supporting functional and object-oriented programming. Common data types include numbers, strings, lists, dictionaries, tuples, and files. Functions and classes can be defined to organize and reuse code. Regular expressions provide powerful string manipulation. Python has a large standard library and is used widely in areas like GUIs, web scripting, AI, and scientific computing.
1. Python can be used to automate repetitive tasks like data entry, file processing, report generation etc. This saves time and reduces human errors.
2. Python has many libraries for machine learning, data analysis and visualization which can be used to analyze patent data, identify trends, cluster similar technologies etc.
3. Web scraping and web development frameworks like Django can be used to build internal tools and dashboards to manage workflows more efficiently.
4. Python scripts can be written to extract and process data from various sources, perform calculations, format reports in a standardized way reducing manual efforts.
The document discusses various built-in functions in Python including numeric, string, and container data types. It provides examples of using list comprehensions, dictionary comprehensions, lambda functions, enumerate, zip, filter, any, all, map and reduce to manipulate data in Python. It also includes references to online resources for further reading.
Why we are submitting this talk? Because Go is cool and we would like to hear more about this language ;-). In this talk we would like to tell you about our experience with development of microservices with Go. Go enables devs to create readable, fast and concise code, this - beyond any doubt is important. Apart from this we would like to leverage our test driven habbits to create bulletproof software. We will also explore other aspects important for adoption of a new language.
GE8151 Problem Solving and Python ProgrammingMuthu Vinayagam
The document provides information about various Python concepts like print statement, variables, data types, operators, conditional statements, loops, functions, modules, exceptions, files and packages. It explains print statement syntax, how variables work in Python, built-in data types like numbers, strings, lists, dictionaries and tuples. It also discusses conditional statements like if-else, loops like while and for, functions, modules, exceptions, file handling operations and packages in Python.
The document contains questions about Python operators, data types, control flow statements like if/else and loops like for/while loops. It also includes questions about string operations, file handling and input/output functions in Python.
This document summarizes Python basics including its features, popularity in different fields and companies, data types, control flow, containers like lists and dictionaries, NumPy for numerical computing, and classes. Python is an interpreted, general-purpose language with rich library support. It is commonly used in computer science, data analysis, biology, and academic communities. Major companies like Google, Dropbox, and Instagram use Python.
This document summarizes Python basics including its features, popularity in different fields and companies, data types, control flow, containers like lists and dictionaries, NumPy for numerical computing, and classes. Python is an interpreted, general-purpose language with rich library support. It is commonly used in computer science, data analysis, biology, and academic communities. Major companies like Google, Dropbox, and Instagram use Python.
Groovy is a dynamic language for the Java platform that provides features inspired by languages like Python, Ruby and Smalltalk. It allows Java developers to use these features with a syntax that is very similar to Java. Groovy code can be compiled to Java bytecode and integrated with Java applications and libraries. It supports features like closures, metaprogramming, builders and templates to improve developer productivity.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
Building Production Ready Search Pipelines with Spark and MilvusZilliz
Spark is the widely used ETL tool for processing, indexing and ingesting data to serving stack for search. Milvus is the production-ready open-source vector database. In this talk we will show how to use Spark to process unstructured data to extract vector representations, and push the vectors to Milvus vector database for search serving.
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc
How does your privacy program stack up against your peers? What challenges are privacy teams tackling and prioritizing in 2024?
In the fifth annual Global Privacy Benchmarks Survey, we asked over 1,800 global privacy professionals and business executives to share their perspectives on the current state of privacy inside and outside of their organizations. This year’s report focused on emerging areas of importance for privacy and compliance professionals, including considerations and implications of Artificial Intelligence (AI) technologies, building brand trust, and different approaches for achieving higher privacy competence scores.
See how organizational priorities and strategic approaches to data security and privacy are evolving around the globe.
This webinar will review:
- The top 10 privacy insights from the fifth annual Global Privacy Benchmarks Survey
- The top challenges for privacy leaders, practitioners, and organizations in 2024
- Key themes to consider in developing and maintaining your privacy program
GraphRAG for Life Science to increase LLM accuracyTomaz Bratanic
GraphRAG for life science domain, where you retriever information from biomedical knowledge graphs using LLMs to increase the accuracy and performance of generated answers
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Driving Business Innovation: Latest Generative AI Advancements & Success StorySafe Software
Are you ready to revolutionize how you handle data? Join us for a webinar where we’ll bring you up to speed with the latest advancements in Generative AI technology and discover how leveraging FME with tools from giants like Google Gemini, Amazon, and Microsoft OpenAI can supercharge your workflow efficiency.
During the hour, we’ll take you through:
Guest Speaker Segment with Hannah Barrington: Dive into the world of dynamic real estate marketing with Hannah, the Marketing Manager at Workspace Group. Hear firsthand how their team generates engaging descriptions for thousands of office units by integrating diverse data sources—from PDF floorplans to web pages—using FME transformers, like OpenAIVisionConnector and AnthropicVisionConnector. This use case will show you how GenAI can streamline content creation for marketing across the board.
Ollama Use Case: Learn how Scenario Specialist Dmitri Bagh has utilized Ollama within FME to input data, create custom models, and enhance security protocols. This segment will include demos to illustrate the full capabilities of FME in AI-driven processes.
Custom AI Models: Discover how to leverage FME to build personalized AI models using your data. Whether it’s populating a model with local data for added security or integrating public AI tools, find out how FME facilitates a versatile and secure approach to AI.
We’ll wrap up with a live Q&A session where you can engage with our experts on your specific use cases, and learn more about optimizing your data workflows with AI.
This webinar is ideal for professionals seeking to harness the power of AI within their data management systems while ensuring high levels of customization and security. Whether you're a novice or an expert, gain actionable insights and strategies to elevate your data processes. Join us to see how FME and AI can revolutionize how you work with data!
“An Outlook of the Ongoing and Future Relationship between Blockchain Technologies and Process-aware Information Systems.” Invited talk at the joint workshop on Blockchain for Information Systems (BC4IS) and Blockchain for Trusted Data Sharing (B4TDS), co-located with with the 36th International Conference on Advanced Information Systems Engineering (CAiSE), 3 June 2024, Limassol, Cyprus.
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slackshyamraj55
Discover the seamless integration of RPA (Robotic Process Automation), COMPOSER, and APM with AWS IDP enhanced with Slack notifications. Explore how these technologies converge to streamline workflows, optimize performance, and ensure secure access, all while leveraging the power of AWS IDP and real-time communication via Slack notifications.
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
2. http://blog.xcoda.net
Python basic
Introduction
Python
Guido Van Rossum(귀도 반 로섬)
네델란드 암스테르담, 1989 python 개발
구글(전), 드롭박스 근무
영국 BBC 코미디, “Monty Python’s Flying Circus”
MIT 1학년에게 LISP 대신 Python 가르치다
2가지 버전 : 2.x, 3.x
여기서는 2.7.x 만 다룬다
대화형 인터프리터 언어
플랫폼 독립적
동적 테이타 타입
빠른 개발 목적
간단하고 쉬운 문법(?)
객체지향언어
다양한 내장 객체 자료형
Garbage Collection
3. http://blog.xcoda.net
Python basic
Introduction
API Document
Standard API : https://docs.python.org/2/library/
Built in Function : https://docs.python.org/2/library/functions.html
String Method : https://docs.python.org/2/library/stdtypes.html#string-methods
Global Modules : https://docs.python.org/2/py-modindex.html
External Modules : https://pypi.python.org/pypi
Help system
대화형 콘솔에서 help()를 이용하면 문서를 볼 수 있다
한줄 아래 : 엔터, 아래 방향키, j
한줄 위로 : 위 방향키, k
한 페이지 아래 : 스페이스키, f
한 페이지 위로 : b
빠져나올때 : q
>>> help(range)
>>> help(‘’.split)
>>> help(‘’.join)
>>>import random
>>>help(random)
5. http://blog.xcoda.net
Python basic
Syntax
Syntax
대소문자 구분
괄호 대신 들여 쓰기
pass
함수나 조건문의 내용이 없을 경우
주석
# 한줄 주석
‘’’(홋따옴표 * 3), “””(쌍따옴표*3) : 여러줄 주석
문장의 끝
세미콜론(;) 없이 줄바꿈기호로 대신
문장의 끝 의미 없이 줄바꿈 하고자 할때는 (역 슬레쉬)
한글 지원
# -*- coding:utf-8 -*-
파일의 시작에 표시
u’한글’
문자열의 앞에 u 표시
# -*- coding:utf-8 -*-
'''
Created on Dec 6, 2015
@author: xcoda
''’
'''
여러줄 주석
'''
""""
여러줄 주석
"""
#한줄 주석
6. http://blog.xcoda.net
Python basic
Syntax
Data type
int, float, bool(True, False), str, None
list[1,2,3], tuple(1,2,3), dict{1:’a’, 2:’b’}, set{1,2,3}
type()
동적으로 타입을 확인
변수
선언문 없음
값의 할당에 따라 데이타 타입 동적 바인딩
모든 변수는 객체
이름
소문자_소문자
id()
UID(주소번지) 확인
int.bit_length()
값의 표현에 사용한 비트 길이
print type(1)
print type(3.14)
print type(True)
print type(False)
print type('a')
print type('abcd')
print type(None)
list = ['one', 'two', 'three']
tuple = ('one', 'two', 'trhee')
set = set(['one', 'two', 'trhee'])
dict = {'a': 'one', 'b':'two', 'c': 'three'}
print type(list) #list
print type(tuple) #tuple
print type(set) #set
print type(dict) #dictionary
7. http://blog.xcoda.net
Python basic
Syntax
콘솔입출력
input(prompt)
사용자 입력을 즉시 평가
raw_input(prompt)
사용자 입력을 문자열로 반환
print exp1, exp2…
콘솔 출력
튜플 형식
문자열
‘ ’, “ “
홋따옴표, 겹따옴표
== 연산
id가 달라도 내용이 같으면 True
len(str)
문자열의 길이
포맷 문자
%s: 문자열, %d:정수, %f:실수
인덱싱 : 튜플
str[0], str[0:4]
input1 = raw_input() #abc 입력
input2 = raw_input() #abc 입력
print input1, id(input1) # abc 4382273632
print input2, id(input2) #abc 4382273680
print input1 == input2 #True
msg = ‘my age is %d’ %25
print msg
8. http://blog.xcoda.net
Python basic
Syntax
연산자
‘abc’ + ‘def’
‘abcdef’
‘abc’ + 2
오류 발생
‘abc’ * 3
‘abcabcabc’
7 / 4.0
1.75
7 // 4.0 : 소수점 아래 버림 연산
1.0
논리 연산
a == b, a != b, a > b, a >=b, a < b, a<=b
a and b
a or b
not a
a in b
a not in b
22. http://blog.xcoda.net
Python basic
연습문제
Hanman
단어 알아 맞히기
주어진 단어 6개
사용자가 예상되는 한글자 또는 단어 입력
--- 과 같이 표시
맞으면 맞는 부분만 알파벳 표시
14번 기회
<출력 예시>
---
Lives Remaning: 14
Guess a letter or whole word?d
d—
Lives Remaning: 13
Guess a letter or whole word?z
d—
Lives Remaning: 12
Guess a letter or whole word?g
d-g
Lives Remaning: 13
Guess a letter or whole word?o
You win! Well Done!
23. http://blog.xcoda.net
Python basic
연습문제
Hangman
import random
words = ['chicken', 'dog', 'cat', 'mouse', 'frog']
lives_remaining = 14
guessed_letters = ''
def pick_a_word():
return random.choice(words)
def play():
word = pick_a_word()
while True:
guess = get_guess(word)
if process_guess(guess, word):
print('You win! Well Done!')
break
if lives_remaining ==0:
print('You are Hung!')
print('The word was: ' + word)
break
24. http://blog.xcoda.net
Python basic
연습문제
Hangman
def get_guess(word):
print_word_with_blanks(word)
print 'Lives Remaning:', str(lives_remaining)
guess = raw_input('Guess a letter or whole word?')
return guess
def print_word_with_blanks(word):
display_word = ''
for letter in word:
if guessed_letters.find(letter) > -1:
display_word = display_word + letter
else:
display_word = display_word +'-'
print display_word #, guessed_letters, word
def process_guess(guess, word):
if len(guess) > 1:
return whole_word_guess(guess, word)
else:
return single_letter_guess(guess, word)
25. http://blog.xcoda.net
Python basic
연습문제
Hangman
def whole_word_guess(guess, word):
global lives_remaining
if guess == word:
return True
else :
lives_remaining -= 1
return False
def single_letter_guess(guess, word):
global guessed_letters
global lives_remaining
if word.find(guess) == -1:
lives_remaining -= 1
guessed_letters = guessed_letters + guess
if all_letters_guessed(word):
return True
return False
def all_letters_guessed(word):
for letter in word:
if guessed_letters.find(letter) == -1:
return False
return True
if __name__ == '__main__':
play()
26. http://blog.xcoda.net
Python basic
Module
Module, Pacakge
import random
random.radnint(1,6)
imoprt random as r
r. radnint(1,6)
from random import randint
randint(1,6)
from random import *
Randint(1,6)
27. http://blog.xcoda.net
Python basic
Class
Class
class Car:
pass
myCar = Car()
print type(myCar)
class Car:
name = ’Sonanta'
def drive(self):
print ’run :’, self.name
myCar = Car()
print type(myCar)
print myCar
myCar.drive()
28. http://blog.xcoda.net
Python basic
Class
Inheritance
classCar(object):
engine =None
def__init__(self, engine):
self.engine = engine
defdrive(self):
ifself.engine ==None:
print"can't drive caunsed by no engine"
else:
print'driving..'
classSuperCar(Car):
def__init__(self, engine):
super(SuperCar, self).__init__(engine)
#Car.__init__(self, engine)
defdriveFast(self):
print'driving fast very much...'
33. http://blog.xcoda.net
Python basic
Web Architecture
Web Architecture
HTML
① HTTP
Request
② HTTP
Response
URI
File System
<DocRoot>
HTML
HTML
HTML
URL
Parse
Dynamic
Module
or
WAS
Sand Box
HTML
Web Browser
(HTTP Client)
Web Server
(HTTP Server)
③ Display
35. http://blog.xcoda.net
Python basic
HTTP
Hyper-Text Transfer Protocol over TCP/IP
History
HTTP 0.9 : No Spec Sheet
HTTP 1.0 :
Fix : 1996’ IETF RFC 1945
Difference between spec and implementation
Added Header, GET Method
HTTP 1.1 :
Fix : 1997’ IEFT RFC 2068,
Rev. 1999’, RFC 2616(Current Version)
Cache Control, connection keep
http://tools.ietf.org/html/rfc2616
Feature
Connectionless
Stateless
Request and Response
36. http://blog.xcoda.net
Python basic
HTTP
HTTP Request Structure
Division Example
Request line
<request_method><URI><HTTP_Ver>
GET /index.html HTTP/1.1
Request Header
(General |Request | Entity Header)*
<header_name> : <header_value><CR><LF>
Host : www.example.com:80
User-Agent : Mozilla/5.0
Accept : text/html
Accept-Language : en-us
Accept-Encoding : gzip, delate
Date : Tue, 3 Oct 1974 02:16:00 GMT
Connection : keep-alive
An Empty line
<CR><LF>
<carriage return>
Optional Message Body POST Data
37. http://blog.xcoda.net
Python basic
HTTP
Request Methods
Request Method Description
GET 지정된 URL의 정보를 가져온다.
POST 지정된 URL로 Body에 포함된 정보를 제출한다.
PUT 지정된 URL에 저장될 정보를 전달한다.
DELETE 지정된 Resource를 삭제한다.
HEAD
응답 헤더를 요청한다.
Response Body가 없는 걸 제외 하면 GET과 동일
OPTIONS 지정된 URL이 지원하는 HTTP methods를 요청
TRACE
Echoes back
수신된 메시지를 다시 전송한다.
CONNECT Proxy 사용에 예약되어 있다.
38. http://blog.xcoda.net
Python basic
HTTP
HTTP Request Example
GET /index.html HTTP/1.1
Host: www.example.com
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0.1) Gecko/20100101
Firefox/5.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: UTF-8,*
Connection: keep-alive
Referer: http://www.google.com/url?sa=t&source=web&cd=1
Cookie: mediaWiki.user.bucket%3Aext.articleFeedback-options=8%3Ashow; If-Modified-
Since Sat, 13 Aug 2011 19:57:28 GMT
Cache-Control: max-age=0
39. http://blog.xcoda.net
Python basic
HTTP
HTTP Response Structure
Division Example
Response line
<HTTP ver><status code><status-message>
HTTP/1.1 200 OK
Response Header
(General |Response | Entity Header)*
<header_name>:<header_value><CR><LF>
Host : www.example.com:80
User-Agent : Mozilla/5.0
Accept : text/html
Accept-Language : en-us
Accept-Encoding : gzip, delate
Date : Tue, 3 Oct 1974 02:16:00 GMT
Connection : keep-alive
Content-Type : text/html;charset=UTF-8
An Empty line <CR><LF>, carriage return
Message Body HTML Contents
41. http://blog.xcoda.net
Python basic
HTTP
Response Status Code
Range Status Code Description
1xx
Informational
100 Continue
101 Switching protocols
2xx
Success
200 OK
201 Created
202 Accepted
203 Non-authoritive
information
204 No connect
205 Reset content
206 Partial content
207 Multi-Status(WebDAV)
226 IM Used
42. http://blog.xcoda.net
Python basic
HTTP
Response Status Code
Range Status Code Description
3xx
Redirection
300 Multiple choices
301 Moved Permanently
302 Found
303 See other
304 Not Modified
305 Use proxy
306 Switch proxy
307 Temporary Redirect
308 Resume Incomplete
43. http://blog.xcoda.net
Python basic
HTTP
Response Status Code
Range Status Code Description
4xx
Client Error
400 Bad Request
401 Unauthorized
402 Payment required
403 Forbidden
404 Not found
405 Method not allowed
406 Not Acceptable
407 Proxy authentication required
408 Request timeout
409 Confilct
410 Cone
44. http://blog.xcoda.net
Python basic
HTTP
Response Status Code
Range Status Code Description
5xx
Server Error
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version not supported
506 Variant Also negotiates
507 Insufficient storage (WebDAV)
509 Bandwidth limit exceeded
510 Not Extended
45. http://blog.xcoda.net
Python basic
HTTP
Multipurpose Internet Media Extensions Type
Internet Media Type
Content-type
Syntax
Example
<type>/<subtype>;[<parameter-name>=<parameter-value>
Content-Type : text/html;charset=UTF-8
46. http://blog.xcoda.net
Python basic
HTTP
Socket Webserver
from socket import *
sock = socket(AF_INET, SOCK_STREAM)
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
sock.bind(('', 8080))
sock.listen(1)
print 'server listening on 8080...'
while True:
conn, addr = sock.accept()
req = ''
while True:
req += conn.recv(1024)
if req.endswith('rnrn'):
req_line = req.split('rn')[0]
print req_line
method, url, ver = req_line.split()
print url
break
conn.send("HTTP/1.1 200 OKnContent-Type:text/htmlnn<h1>Welocome to My server</h1>n")
conn.close()
sock.close()