"프로그래밍"에 해당되는 글 - 3건
Post
import os
file_path = '.\\pic'
file_names = os.listdir(file_path)
file_new_name = "사진이름변경"
i = 1
for name in file_names:
src = os.path.join(file_path, name)
dst = file_new_name + str(i) + '.jpg'
dst = os.path.join(file_path, dst)
os.rename(src, dst)
i += 1
python 폴더 내 파일 이름 변경
간단한 예제.
1) cmd 창을 켜고 해당 python 코드가 있는 폴더로 이동
2) py python파일이름.py
이렇게 실행하면 된다.
파일이름+숫자.....로 생성된다.
'이전게시판 > Python' 카테고리의 다른 글
파이썬 한글 글자수 체크 및 특정 단어 갯수 찾기 (0) | 2025.03.30 |
---|---|
inconsistent use of tabs and spaces in indentation in Python (0) | 2024.04.18 |
ModuleNotFoundError: No module named 'pandas' 아나콘다가 깔려 있을 때 해결법 (0) | 2024.01.27 |
Python 크롤링 리스트 출력 (0) | 2023.04.10 |
Post
VSCODE 자동완성 끄기
1. Ctrl+,
2. intellisense 검색. 보이는 모든 체크 박스 해제
3. 귀찮다면 설정 json 파일 열기 (문서에 빙그르르 돌아가는 화살표)에다가 아래코드 붙여넣기
"explorer.compactFolders": false,
"explorer.confirmDragAndDrop": false,
"editor.suggest.showConstants": false,
"editor.suggest.showConstructors": false,
"editor.suggest.showCustomcolors": false,
"editor.suggest.showDeprecated": false,
"editor.suggest.showEnumMembers": false,
"editor.suggest.showEnums": false,
"editor.suggest.showEvents": false,
"editor.suggest.showFields": false,
"editor.suggest.showFiles": false,
"editor.suggest.showFolders": false,
"editor.suggest.showFunctions": false,
"editor.suggest.showInterfaces": false,
"editor.suggest.showIssues": false,
"editor.suggest.showKeywords": false,
"editor.suggest.showMethods": false,
"editor.suggest.showModules": false,
"editor.suggest.showOperators": false,
"editor.suggest.showProperties": false,
"editor.suggest.showReferences": false,
"editor.suggest.showSnippets": false,
"editor.suggest.showStructs": false,
"editor.suggest.showTypeParameters": false,
"editor.suggest.showUnits": false,
"editor.suggest.showUsers": false,
"editor.suggest.showValues": false,
"editor.suggest.showVariables": false,
"editor.suggest.showWords": false,
"editor.suggest.showClasses": false,
"editor.suggest.showColors": false
'이전게시판 > etc' 카테고리의 다른 글
엑셀에서 이름 만들고 참조하기 (0) | 2024.12.31 |
---|---|
구글 스프레드 시트 테이블 계열을 추가하여 데이터 시각화 시작 (0) | 2024.12.30 |
파일 형식 또는 파일 확장명이 잘못되어 파일을 열 수 없습니다. 파일이 손상되지 않았는지 파일 확장명이 파일 형식과 일치하는지 확인하십시오 (0) | 2024.12.16 |
크롬에서 jfif확장자 png나 jpg로 저장하기(jfif to png) (0) | 2024.07.07 |
알리 익스프레스 매크로 키보드 설정 에러 Unhandled exception has occurred in your application (0) | 2024.05.31 |
오랜만에 듀오링고 했는데 개 재밌네ㅠㅠ (0) | 2023.08.11 |
PYTHON ModuleNotFoundError: No module named 'bs4' (0) | 2023.04.09 |
VSCODE 글자 색상 변경 (0) | 2023.02.21 |
Post
inconsistent use of tabs and spaces in indentation in Python
inconsistent use of tabs and spaces in indentation in Python 에러는 탭이 아니라 띄어쓰기를 했을 경우에 발생한다. 겉보기에는 똑같지만 탭과 띄어쓰기는 다르니까 확인해보고 띄어쓰기나 탭을 지웠다가 다시 탭을 해보면 된다.
print(line.text)
^^^^^^^^^
AttributeError: 'str' object has no attribute 'text'
AttributeError: 'str' object has no attribute 'text'
이건 line 안에 text가 없어서 나는 에러이다. 그냥 line을 써주면 된다.
'이전게시판 > Python' 카테고리의 다른 글
파이썬 한글 글자수 체크 및 특정 단어 갯수 찾기 (0) | 2025.03.30 |
---|---|
python 폴더 내 파일 이름 변경 rename (0) | 2025.03.30 |
ModuleNotFoundError: No module named 'pandas' 아나콘다가 깔려 있을 때 해결법 (0) | 2024.01.27 |
Python 크롤링 리스트 출력 (0) | 2023.04.10 |