python81 [Python] Dictionary Data Structure Dictionary is a data structure with key and value. Dictionary is internally implemented as hash table, so dictionary is a fast data structure. Dictionary is unordered before Python 3.6, and ordered after Python 3.7. The key of dictionary must be unique. Creating Dictionary There are many ways to create dictionary. ### {} method emptyDict = {} testDict = { "key1": "value1", "key2": "value2", "key.. 2020. 12. 6. [Python] Templates Static Files in Flask Templates Overview Templates are files that contain static data as well as placeholders for dynamic data. A template is rendered with specific data to produce a final document. Flask uses the Jinja template library to render templates. In the application, we will use templates to render span style="color: #0593d3;">HTML which will display in the user's browser. In Flask, Jinja is configured to a.. 2020. 10. 23. [Python] pathlib module (Object-Oriented Filesystem Paths) Python version 3.4 and above basically includes this module. This module offers classes representing filesystem paths with semantics appropriate for different operating systems. This module treats the file system path as an object, not just a string. Path classes are divided between pure paths, which provide purely computational operations without I/O, and concrete paths, which inherit from pure.. 2020. 10. 13. [Python] Getting Started with Flask In this posting, I'll show you to create a simple web server with Flask. I usually use Flask when I develop a side project. You can make it that easily and quickly. Then, Let's start it. Installation $ pip install flask All you need is Flask. A Minimal Application Create app.py file. from flask import Flask app = Flask("Hello Flask") @app.route('/') def home(): return 'Hello, World!' Give the na.. 2020. 10. 11. [Python] Beautiful Soup4 module ※ 2020.10.09 Beautiful Soup is a library that makes it easy to scrape information from web pages. In addition, Beautiful Soup is a Python library for pulling data out of HTML and XML data. I will focus on the things that are frequently used. Installation $ pip install beautifulsoup4 Usage from bs4 import BeautifulSoup soup = BeautifulSoup(data, 'html.parser') Import the BeautifulSoup module, and.. 2020. 10. 9. [Python] requests module requests is a simple HTTP library for Python. Let's find out about it. Installation $ pip install requests Test Server I will use some test servers for example. httpbin.org httpbin.org is a simple HTTP request and response service. jsonplaceholder.typicode.com jsonplaceholder.typicode.comis a fake online REST API server. Usage You can simply use this. import requests rsp = requests.post("http://.. 2020. 10. 8. [Python] pip pip is the package installer for Python. It is similar to gem of Ruby and npm or yarn of Nodejs. If Python 2.x and 3.x are installed together, it can be used like pip3 to distinguish the version. pip is contained in Python. Usage Self Upgrade - On MAC / Linux $ pip install -U pip - On Windows $ python -m pip install -U pip Check Packages are Installed $ python -c 'import ' Install Latest Version.. 2020. 9. 11. [Python] venv venv provides python virtual environment, so it helps to separate a package dependencies per project. we had to use virtualenv before Python 3.4, but since then it has been built-in as a basic tool. Usage The following usage contains a . It means that the name of virtual environment and it will become a folder name as well. Create a virtual environment $ python3 -m venv Activate a virtual enviro.. 2020. 8. 29. [Python] pyenv pyenv is a python version managing tool. Installation On MAC $ brew install pyenv On Windows Previously, we should use a pip. $ pip3 install pyenv-win --target $HOME/.pyenv But, now!!! We can use the chocolatey~!!! YAY~!!! $ choco install -y pyenv-win We no longer have to add environment variables directly !!! Usage Show available list $ pyenv install -l Show installed list $ pyenv versions Show.. 2020. 8. 29. 이전 1 ··· 4 5 6 7 다음