빛나는 하얀치아

'아침편지' 카테고리의 다른 글
| 재능만 믿지 말고... (0) | 2023.05.30 |
|---|---|
| 지금 내 가슴을 뛰게 하는 것은 (0) | 2023.05.29 |
| 내 인생의 '가장 젊은 날' (0) | 2023.05.26 |
| 얼굴의 주름, 지혜의 주름 (0) | 2023.05.25 |
| 정신력을 단련하는 곳 (0) | 2023.05.24 |
빛나는 하얀치아

| 재능만 믿지 말고... (0) | 2023.05.30 |
|---|---|
| 지금 내 가슴을 뛰게 하는 것은 (0) | 2023.05.29 |
| 내 인생의 '가장 젊은 날' (0) | 2023.05.26 |
| 얼굴의 주름, 지혜의 주름 (0) | 2023.05.25 |
| 정신력을 단련하는 곳 (0) | 2023.05.24 |
화면 리사이즈시 사이즈 확인 및 미디어쿼리 확인
https://jsfiddle.net/mill01/1jedsc76/8/
media queries - JSFiddle - Code Playground
jsfiddle.net
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.example {
padding: 20px;
color: white;
}
/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {
.example {background: red;}
}
/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {
.example {background: green;}
}
/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {
.example {background: blue;}
}
/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {
.example {background: orange;}
}
/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {
.example {background: pink;}
}
</style>
<script>
$( window ).resize(function() {
//창크기 변화 감지
var windowWidth = $( window ).width();
$("#width_size").val(windowWidth);
});
</script>
</head>
<body>
<h2>Typical Media Query Breakpoints</h2>
<input type="text" id="width_size" >
<p class="example">Resize the browser window to see how the background color of this paragraph changes on different screen sizes.</p>
</body>
</html>


| [jQuery] jQuery .each , $.trim li에서 텍스트 추출, 공백제거 (0) | 2023.06.23 |
|---|---|
| [jQuery] jQuery .data() (0) | 2023.05.30 |
| [javascript] 엔터키 입력 이벤트, KeyboardEvent keyCode (0) | 2023.05.26 |
| [VS Code] 인코딩 변경 (0) | 2023.05.09 |
| [ javascript ] CDATA 사용 이유 (0) | 2023.05.08 |
[python] 소스경로와 실행경로가 다를때 os.chdir()
# 파이썬 컴파일 경로가 달라서 현재 폴더의 이미지를 호출하지 못할때 작업디렉토리를 변경한다.
import os
from pathlib import Path
# src 상위 폴더를 실행폴더로 지정하려고 한다.
real_path = Path(__file__).parent.parent
print(real_path)
#작업 디렉토리 변경
os.chdir(real_path)
| 처리내용 | os 및 os.path | pathlib |
| 현재의 디렉토리를 취득 | os.getcwd() | Path.cwd() |
| 맨 앞의 ~를 홈 디렉토리에 치환 | os.path.expanduser() | Path.expanduser(), Path.home() |
| 경로의 존재 확인 | os.path.exists() | Path.exists() |
| 디렉토리인가를 판단 | os.path.isdir() | Path.is_dir() |
| 파일인가를 판단 | os.path.isfile() | Path.is_file() |
| 심볼릭 링크인가를 판단 | os.path.islink() | Path.is_symlink() |
| 절대경로인가를 판단 | os.path.isabs() | PurePath.is_absolute() |
| 절대경로로 변환 | os.path.abspath() | Path.resolve() |
| status를 취득 | os.stat() | Path.stat(), Path.owner(), Path.group() |
| 경로를 연결 | os.path.join() | PurePath.joinpath() |
| 파일명을 취득 | os.path.basename() | PurePath.name |
| 새로운 디렉토리를 취득 | os.path.dirname() | PurePath.parent |
| 확장자를 분할·취득 | os.path.splitext() | PurePath.suffix |
객체 지향 파일 시스템 경로, 즉 파일을 객체로 관리하겠다는것 같음.
아래 그림은 Pathlib 내부 객체들의 상속관계로, 가장 기본적인 객체는 PurePath임을 알 수있음.
대략적인 객체간 의미와 관계를 알기 위해 라이브러리를 뜯어봄 -> pathlib.py

os.path 와 Pathlib의 가장 큰 차이점은, 경로를 문자열로 다루냐, 객체로 다루냐 차이인데, 모든 것이 객체로 이루어진 python 인 만큼, Pathlib가 자연스러운 모듈이며 객체 내부적으로 정의된 연산자를 사용할 수 있어 경로에 있어 더 자연스러운 표현이 가능함.
기본적인 사용법은 알아야, 나중에 쓸 일이 있으면 찾아보지 않고 쓸 수 있으니 대충정리해보자.
1. 탐색
논리적 경로와, 절대 경로와의 구분을 잘 해야 함. 논리 경로 상에서, 앵커나 빈 경로는 넘어갈 수 없음. 코드상으로 경로 탐색에 사용할 수 있는 것은, .parent, .parents, .iterdir() 등이 있음.
상위 디렉토리로 넘어가기 위해선, .parent를 사용하나, 사용하기 전 절대경로로 바꾸고, 현재 경로가 디렉토리이면, .iterdir()를 통해 자식 경로를 얻을 수 있음.
from pathlib import Path
p = Path('.') # PosixPath('.')
p.resolve() # os.path.abspath()
p.resolve().parent
list(p.iterdir()) # iteration, list 변환, = os.listdir()
2. 연산자
연산자를 사용하여 경로 조합 가능.
from pathlib import Path
p = Path.home() # os.path.expanduser()
p_sub = p / 'foo' / 'bar' # PosixPath('/Users/kyuu/foo/bar')
p_sub = Path(p, 'foo', 'bar') # os.path.join() 모방
| [python] 파이썬 식별자(Identifiers) (0) | 2023.05.31 |
|---|---|
| [python] calendar 모듈, 달력 사용하기 (0) | 2023.05.30 |
| [python] Sorting-Algorithms-Visualizer (0) | 2023.05.26 |
| [python] Use Phone Camera with python (0) | 2023.05.24 |
| [python] Google 지도 서비스용 Python 클라이언트 (0) | 2023.05.22 |
Program made with Python and Pygame module for visualizing sorting algorithms
Support this project by leaving a ⭐
https://github.com/LucasPilla/Sorting-Algorithms-Visualizer/tree/master
GitHub - LucasPilla/Sorting-Algorithms-Visualizer: Program made with Python and Pygame module for visualizing sorting algorithms
Program made with Python and Pygame module for visualizing sorting algorithms - GitHub - LucasPilla/Sorting-Algorithms-Visualizer: Program made with Python and Pygame module for visualizing sorting...
github.com

| [python] calendar 모듈, 달력 사용하기 (0) | 2023.05.30 |
|---|---|
| [python] 소스경로와 실행경로가 다를때 os.chdir(). os.path와 pathlib (0) | 2023.05.26 |
| [python] Use Phone Camera with python (0) | 2023.05.24 |
| [python] Google 지도 서비스용 Python 클라이언트 (0) | 2023.05.22 |
| [Python] 현재 파일/디렉토리 위치 확인 및 변경 (0) | 2023.05.18 |
<!DOCTYPE html>
<html>
<body>
<h1>Keyboard Events</h1>
<h2>The keyCode Property</h2>
<p>Press a keyboard key in the input field and display the value:</p>
<input type="text" size="40" onkeypress="myFunction(event)">
<p id="demo"></p>
<p>The keyCode property is deprecated, use the key property instead.</p>
<script>
function myFunction(event) {
let value= event.which;
document.getElementById("demo").innerHTML = value;
}
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$("#inp").keypress(function(e){
//검색어 입력 후 엔터키 입력하면 조회버튼 클릭
if(e.keyCode && e.keyCode == 13){
$("#btn").trigger("click");
return false;
}
//엔터키 막기
if(e.keyCode && e.keyCode == 13){
e.preventDefault();
}
});
$("#btn").click(function(){
alert("이벤트 감지");
});
});
</script>
<input type="text" class="form-control input-sm" id="inp" name="inp">
<button type="button" class="btn btn-primary btn-sm" id="btn" name="btn">조회</button>
</body>
</html>

| [jQuery] jQuery .data() (0) | 2023.05.30 |
|---|---|
| [javascript] 화면 리사이즈시 사이즈 확인 및 미디어쿼리 확인 (0) | 2023.05.26 |
| [VS Code] 인코딩 변경 (0) | 2023.05.09 |
| [ javascript ] CDATA 사용 이유 (0) | 2023.05.08 |
| 9 Projects You Can Do to Become a Front-End Master in 2023 (0) | 2022.11.02 |
| 외모, 재능, 그리고 재산보다 더 중요한 것 (0) | 2023.06.02 |
|---|---|
| 바람직한 영향력 (0) | 2023.05.31 |
| 중요한 결정을 내릴 때에는 (0) | 2023.05.25 |
| 축복은 고난의 탈을 쓰고 찾아온다 (0) | 2023.05.24 |
| 비판보다는 인정과 격려가 필요한 때입니다 (0) | 2023.05.23 |