반응형
사용자 이름 가져오기 format(os.getlogin())
- format(os.login)
import os
print(format(os.getlogin()))
# C:\User\lucidyul\~~~~
# lucidyul
- 절대경로 설정 예
import os
path = "C:/Users/{}/desktop".format(os.getlogin()) # {}부분에 사용자 이름
print(path) # C:/Users/lucidyul/desktop
반응형
'Programming > Python' 카테고리의 다른 글
[Python] Visual Studio Code에서 No name 'QApplication' in module ‘PyQt5.QtWidgets’ 에러 (No-name-in-module Error) (0) | 2020.10.28 |
---|---|
[Python] PyQt5 QListWidget()에 아이템 추가 (0) | 2020.04.16 |
[Python] pyinstaller 에러 RecursionError: maximum recursion depth exceeded (0) | 2020.01.31 |
[Python] PyQt5 특정 리스트, 딕셔너리를 리스트 뷰에 표시 (0) | 2020.01.31 |
[Python] PyQt5 메시지 박스 / QMessageBox (0) | 2020.01.14 |
댓글