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 |
Tags
- java
- Get
- createSlice
- json-server
- sw expert academy
- redux-saga
- 매일메일
- react-redux
- 코딩테스트합격자되기
- C++
- 알고리즘
- SW
- 이코테
- 항해99
- react
- Python
- maeil-mail
- axios
- redux-toolkit
- 프로그래머스
- 항해플러스
- redux
- 리액트
- programmers
- 자바
- 테코테코
- react-router
- useDispatch
- Algorithm
- JavaScript
Archives
- Today
- Total
Binary Journey
[프로그래머스] 파일명 정렬 본문
반응형
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges
import re
def solution(files):
reg = [re.split(r'(\d+)', s) for s in files]
reg.sort(key = lambda x: (x[0].lower(), int(x[1])))
return [''.join(s) for s in reg]
[프로그래머스] LEVEL2 파일명 정렬 (Python)
프로그래머스 알고리즘 풀이
velog.io
참고: https://stackoverflow.com/questions/430079/how-to-split-strings-into-text-and-number
How to split strings into text and number?
I'd like to split strings like these 'foofo21' 'bar432' 'foobar12345' into ['foofo', '21'] ['bar', '432'] ['foobar', '12345'] Does somebody know an easy and simple way to do this in python?
stackoverflow.com
반응형
'프로그래머스 > level 2' 카테고리의 다른 글
[프로그래머스] 방문 길이 (0) | 2022.01.04 |
---|---|
[프로그래머스] 방금그곡 (0) | 2022.01.04 |
[프로그래머스] 압축 (0) | 2021.12.28 |
[프로그래머스] 가장 큰 정사각형 찾기 (0) | 2021.12.27 |
[프로그래머스] 구명보트 (0) | 2021.12.20 |