Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- DISPATCH
- ios
- Combine
- swift
- Responder chain
- Asnyc
- readLine
- UserDefaults
- 입력
- ReactorKit
- reversed
- moya
- RxSwift
- binder
- vtable
- weak self
- 공백
- hitTest
- UIResponder
- 사내배포
- BidirectionalCollection
- URLSession
- MaxHeap
- delays deallocation
- 전자출입
- AVCaptureSession
- Python
- Custom Class
- async
- input
Archives
- Today
- Total
목록input (2)
틈틈히 적어보는 개발 일기
[Python] 입력받는 문자를 내맘대로!
공백을 기준으로 입력받은 값을 나누어 arr에 배열로 저장합니다. # split() 내부에 '(자를 문자)' 형식으로 특정 문자를 자를수도 있습니다. arr = input().split() # Input: 1 2 3 4 # Output: ['1', '2', '3', '4'] 각각의 문자를 int 형으로 변환하여 각 변수에 저장(매핑)합니다. # int 대신 다른 자료형을 사용할 수 있습니다. x, y = map(int, input().split()) # Input: 1 2 # Output: x = 1, y = 2 int 형으로 변환된 각 변수들을 list 형식으로 변환하여 저장합니다. arr = list(map(int, input().split())) # Input 1 2 3 4 # Output [1, ..
🍯 알고리즘
2021. 2. 2. 19:34
[Python]파이썬 입력 받기, input(), readline()
기존에 파이썬 입력 받을때 n = input() 이런 느낌으로 받았는데 이게 속도가 느리다고 한다. 그래서 import sys n = sys.stdin.readline().rstrip() 이렇게 변경 했는데 글자수가 너무 길어져서 import sys def read(): return sys.stdin.readline().rstrip() n = read() 로 변경해서 사용중이다. 나름 편하고 괜찮은 것 같다 여기서 rstrip()은 readline()에서 읽어들인 마지막 엔터도 같이 입력을 받기 때문에 제거하는 기능을 한다. strip() 관련한 글은 추후에 한번 작성해봐야겠다.
🍯 알고리즘
2021. 2. 2. 19:07