- C언어
- 라즈베리파이4
- 디지털오션 드로플릿
- 자바 파일 한줄씩 읽기
- c file read
- ubuntu node js
- Python
- 디지털오션 클라우드서버 생성하기
- Ubuntu timezone
- npm버전확인
- 우분투 node js 설치
- node 버전확인
- raspi-config
- 디지털오션 서버생성하기
- tzselect
- Node.js express install
- 파이썬 반복문
- node js 버전확인
- 우분투 시간설정
- express install
- mysql index 생성
- 파이썬
- 우분투 시간변경
- c언어 파일 읽기
- ubuntu node js install
- 자바 한줄씩 읽기
- 클라우드서버 생성
- node js express install
- java 숫자를 문자로 변환하기
- index 생성
- Today
- Total
목록Python (9)
호그래머
1. Python에서 Lists 사용하기 fruits=['apple', 'banana', 'lemon', 'cherry', 'pear', 'grapes'] print(fruits) print(fruits[0]) print(fruits[5]) print(fruits[-2]) print(fruits[2:]) print(fruits[1:3]) 리스트는 0부터 시작 결과 끝 1. Python에서 Lists를 사용할 수 있다. 2. Lists의 시작은 0부터 시작한다.
1. Python에서 while문 사용하기 i=1 while i < 10: print(i) i=i+1 print("while 끝!") 결과 끝 1. Python에서 쉽게 while문을 사용할 수 있다.
1. Python에서 for문 사용하기 for item in range(10): print(item) print("첫번 째 포문 끝!") for item in range(6,10): print(item) print("두번 째 포문 끝!") for item in range(6,10,2): print(item) print("두번 째 포문 끝!") 결과 끝 1. Python에서 쉽게 for문을 사용할 수 있다.
1. Python에서 if문 사용하기 is_alive=True name="Ben" age=99 if is_alive: print("트루") else: print("펄스") if name=="Ben": print(name) elif name=="Dan": print(name) if age==99: print(age) elif age==98: print(age) elif age==97: print(age) 결과 끝 Python에서 if문을 사용 할 수있다.
1. python text파일 읽기 file_path = "D:/WORK/Python/티스토리/230625/test.txt" with open(file_path, "r") as file: file_content = file.read() print("파일 읽기 완료") print(file_content) 결과 끝 Python으로 text파일을 쉽게 읽을 수 있다.
1. Python text 파일로 쓰기 txt_file_path = "D:/WORK/Python/티스토리/230625/test.txt" # 텍스트 파일 열기 (쓰기 모드) with open(txt_file_path, "w") as file: # 파일에 내용 쓰기 file.write("ABCDE \n") file.write("가나다라마 \n") file.write("12345") print("파일 쓰기 완료") 해당경로에 test.txt파일이 생성됩니다. 끝 1. 파이썬에서 쉽게 텍스트를 파일로 쓸 수 있다.
1. 파이썬 날짜, 시간 표현하기(Date, Time) import time 필요 import time logfilename = time.strftime("%Y%m%d-%H%M%S") date_Y = time.strftime("%Y") print("4자리 년:"+date_Y) date_y = time.strftime("%y") print("2자리 년:"+date_y) date_m = time.strftime("%m") print("2자리 원:"+date_m) date_d = time.strftime("%d") print("2자리 일:"+date_d) date_Ymd = time.strftime("%Y%m%d") print("8자리 년월일:"+date_Ymd) date_H = time.strftime("%..
1. Python 폴더 생성하기 import os 필요 import os def createFolder(basic_path,dir_name): try: if not os.path.exists(basic_path+"/"+dir_name): os.makedirs(basic_path+"/"+dir_name) print("폴더 생성 완료!") else: print("폴더가 이미 존재합니다!") except OSError: print ('폴더생성 에러 발생! ' + basic_path+"/"+dir_name) dir_path="C:/Users/82105/Desktop" dir_name="테스트폴더" createFolder(dir_path, dir_name) 결과 바탕화면에 "테스트폴더" 이름의 폴더가 생성 됩니다..
1. Python 문자열 자르기 문자열[시작인덱스:종료인덱스] 한글자 자르기 지정 인덱스 이후로 자르기 범위로 자르기 뒤에서 자르기 test_string="ABC456DEF789GHI0.TXT" print("01번: "+test_string[0])#A print("02번: "+test_string[1])#B print("03번: "+test_string[2])#C print("04번: "+test_string[5:])#6DEF789GHI0.TXT print("05번: "+test_string[8:])#F789GHI0.TXT print("06번: "+test_string[11:])#9GHI0.TXT print("07번: "+test_string[0:3])#ABC print("08번: "+test_strin..