๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Python/[Nomad] Web Scrapper

[Introduction&Theory] Python_basic

by ๐Ÿ’œautumn 2020. 8. 3.

[Introduction]

https://nomadcoders.co/courses

 

All Courses – ๋…ธ๋งˆ๋“œ ์ฝ”๋” Nomad Coders

์ดˆ๊ธ‰๋ถ€ํ„ฐ ๊ณ ๊ธ‰๊นŒ์ง€! ๋‹ˆ๊ผฌ์Œค๊ณผ ํ•จ๊ป˜ ํ’€์Šคํƒ์œผ๋กœ ์„ฑ์žฅํ•˜์„ธ์š”!

nomadcoders.co

https://repl.it/

 

The collaborative browser based IDE

Repl.it is a simple yet powerful online IDE, Editor, Compiler, Interpreter, and REPL. Code, compile, run, and host in 50+ programming languages: Clojure, Haskell, Kotlin, QBasic, Forth, LOLCODE, BrainF, Emoticon, Bloop, Unlambda, JavaScript, CoffeeScript,

repl.it

https://docs.python.org/3/library/

 

The Python Standard Library — Python 3.8.5 documentation

The Python Standard Library While The Python Language Reference describes the exact syntax and semantics of the Python language, this library reference manual describes the standard library that is distributed with Python. It also describes some of the opt

docs.python.org


[Theory]

1. Data Types of Python

    1) Variable(๋ณ€์ˆ˜) 

    ์ž๋ฃŒํ˜• ์„ ์–ธ ์•ˆํ•จ, snake_case ํ‘œ๊ธฐ

Class ์ž๋ฃŒํ˜• ๋น„๊ณ 
int number ์ •์ˆ˜
float float ์‹ค์ˆ˜
str string ' ๋˜๋Š” " ์‚ฌ์šฉํ•˜์—ฌ ํ‘œ๊ธฐ
bool boolean True, False(0) (๋Œ€๋ฌธ์ž ํ‘œ๊ธฐ)
NoneType none None์œผ๋กœ ํ‘œ๊ธฐ (์ผ์ข…์˜ NULL : ์•„๋ฌด๊ฒƒ๋„ ์—†์Œ์„ ์ €์žฅ)

* ์ถœ๋ ฅํ•จ์ˆ˜ : print(var) > java์™€ ๋‹ฌ๋ฆฌ '๋ฌธ์ž์—ด+์ˆซ์ž' ์ž๋™ ๊ฒฐํ•ฉX > f ํฌ๋ฉง ์‚ฌ์šฉํ•˜์—ฌ ํ‘œํ˜„

* ์ž๋ฃŒํ˜•ํ™•์ธํ•จ์ˆ˜ : type(var)

 

 

  2) List in Python : Sequence type

      ์—ด๊ฑฐํ˜• >  list, Tuple

Common / Mutable

       (1) List : mutable sequence

           - ์ˆ˜์ •/์—ฐ์‚ฐ ๊ฐ€๋Šฅ = common/ mutable sequence operation ๋‘˜ ๋‹ค ์‚ฌ์šฉ ๊ฐ€๋Šฅ

           - ์—ฌ๋Ÿฌ ์ž๋ฃŒํ˜• ํ•œ๋ฒˆ์— ๊ฐ€๋Šฅ

           - ๋Œ€๊ด„ํ˜ธ ์‚ฌ์šฉ : []

 

       (2) tuple : immutable sequence

        - ์ˆ˜์ •/์—ฐ์‚ฐ ๋ถˆ๊ฐ€๋Šฅ = common sequence operation๋งŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅ

        - ์†Œ๊ด„ํ˜ธ ์‚ฌ์šฉ : ()

 

       (3) Dictionary 

        - ์ˆ˜์ •/์—ฐ์‚ฐ ๊ฐ€๋Šฅ

        - key์™€ value๊ฐ’์œผ๋กœ ๊ตฌ์„ฑ

        - ํ‚ค๋ช…์„ ์ธ๋ฑ์Šค๋กœ ํ™œ์šฉ : ์กฐํšŒ, ์ƒ์„ฑ ๋“ฑ์˜ ์—ฐ์‚ฐ๊ฐ€๋Šฅ

        - ์ค‘๊ด„ํ˜ธ ์‚ฌ์šฉ : {}  { key : value, key : value, ... }

 

 

 

2. Built in Functions

  1) function

    ์ €์žฅํ•˜๊ณ  ์‹ถ์€ ํ–‰๋™(๊ธฐ๋Šฅ)์„ ์ž‘์„ฑ → ์žฌ์‚ฌ์šฉ์„ ์œ„ํ•จ 

ํŒŒ์ด์ฌ ๊ธฐ๋ณธ ๋‚ด์žฅํ•จ์ˆ˜

https://docs.python.org/3/library/functions.html

 

Built-in Functions — Python 3.8.5 documentation

Built-in Functions The Python interpreter has a number of functions and types built into it that are always available. They are listed here in alphabetical order. abs(x) Return the absolute value of a number. The argument may be an integer or a floating po

docs.python.org

 

  2) How to create function?

     ํŒŒ์ด์ฌ ํ•จ์ˆ˜๋Š” define(์ •์˜)ํ•œ๋‹ค๋Š” ํ‘œํ˜„ ์‚ฌ์šฉ

     ๋ธ”๋ก์œผ๋กœ ํ‘œํ˜„ํ•˜์ง€ ์•Š์Œ >> identation(๋“ค์—ฌ์“ฐ๊ธฐ)ํ‘œํ˜„ ์‚ฌ์šฉ

     argument๋Š” ์ฒ˜์Œ์— default๊ฐ’ ์„ค์ • ๊ฐ€๋Šฅ

     ๋ฐ˜ํ™˜์€ return์ด์šฉ = ํ•จ์ˆ˜ํ˜ธ์ถœ์‹œ return๊ฐ’์œผ๋กœ ์น˜ํ™˜

 

 

 

3. Conditionals : IF - ELIF - ELSE

   ์กฐ๊ฑด์ด ์ฐธ์ธ ๊ฒฝ์šฐ ์‹คํ–‰ > ๊ด„ํ˜ธ ๋ฌถ๊ธฐ ์—†์Œ > ๋“ค์—ฌ์“ฐ๊ธฐ

 

4. LOOP : For in

   ์ˆœ์„œ๋Œ€๋กœ ์ž‘์—…์„ ์›ํ•˜๋Š” ๊ฒฝ์šฐ ์‚ฌ์šฉ : for x in [list or str]

 

 

5. Modules

   ์ผ์ข…์˜ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋˜๋Š” ํด๋ž˜์Šค ๊ธฐ๋Šฅ

   import ํด๋ž˜์Šค๋ช…

   from ํด๋ž˜์Šค๋ช… import ํ•จ์ˆ˜๋ช…(๋ชจ๋“ˆ๋ช…) [as ๋ณ„์นญ] > ์‚ฌ์šฉํ•  ํ•จ์ˆ˜๋งŒ ๋ถˆ๋Ÿฌ์˜ค๋Š”๊ฒƒ์„ ์ถ”์ฒœํ–„

 

'Python > [Nomad] Web Scrapper' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[EXTENDING] put Web Scrapper in Server  (0) 2020.08.06
[GET READY FOR DJANGO] OOP  (0) 2020.08.05
[Building a Job Scrapper] How to make Web Scrapper?  (0) 2020.08.04

๋Œ“๊ธ€