여러 인수를 갖는 함수 ex) def add(n1, n2): return n1+n2 두 개의 인수만 가능... 좀 더 유연한 함수, 몇개의 인수라도 입력 가능한 함수 만들기 def add(*manypositionalarguments): sum = 0 for n in manypositionalarguments: sum += n return sum print(add(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) >> 55 * : 필수 args : 대체로 다 이렇게 쓰지만 변경 가능 기본적으로 *args는 tuple 타입이므로 인덱스로 접근도 가능 --> Positional def add(*manypositionalarguments): print(manypositionalarguments[0]) s..
import tkinter #1. import window = tkinter.Tk() #2. window 생성 후 #4. 이 둘 사이에 프로그램을 작성한다 window.mainloop() #3. 윈도우가 떠있게 하고 import tkinter window = tkinter.Tk() window.title("My First GUI Program(20220327) ") window.minsize(width=500, height=300) #Label my_label = tkinter.Label(text="I am a Label", font=("Arial", 24, "bold")) my_label.pack() #label이 표현될 위치 등 정보 window.mainloop() *pack() http://tcl...
* NATO Ponetic Alphabet이 정의된 csv를 이용함. #TODO 1. using csv file, Create a dictionary in this format like: #{"A": "Alfa", "B": "Bravo"} data = pandas.read_csv("./nato_phonetic_alphabet.csv") data_dict_comprehension = { row.letter:row.code for (index,row) in data.iterrows() } #print(data_dict_comprehension) #TODO 2. Create a list of the phonetic code words from a word that the user inputs. word = i..
new_dict = { new_key : new_value for item in list } new_dict = { new_key : new_value for (key, value) in dict.items() } new_dict = { new_key : new_value for (key, value) in dict.items() if test } >> item은 속성값이 아니므로 item() 괄호를 반드시 붙여야 함 ex) names 리스트와 random 점수를 이용해 student_scores 딕셔너리를 이름, 점수로 생성 import random names = ['Alex', 'Kio', 'Freebee', 'Susan', 'Dave', 'Caroline', 'Beth', 'Freddie'] stu..
ex) 리스트의 값들을 1씩 더한 리스트를 만들때 numbers = [1,2,3] #1. 지금까지 방법 예 new_numbers = [] for num in numbers: add_1 = num + 1 new_numbers.append(add_1) #2. List Comprehension #new_list = [ new_item for item in list ] new_numbers = [ num+1 for num in numbers ] --------------------------------------------------------- print(new_numbers) [2, 3, 4] ex) name = "Kio" for i in name: print(i) -------------------- K ..
*weather_data.csv (데이터파일) day,temp,condition Monday,12,Sunny Tuesday,14,Rain Wednesday,15,Rain Thursday,14,Cloudy Friday,21,Sunny Saturday,22,Sunny Sunday,24,Sunny *csv파일을 열고 각 라인을 읽어서 공백/특수기호 제거하고 data 리스트에 넣기 data = [] with open("./weather_data.csv") as csv_data: contents = csv_data.readlines() for line in contents: data.append(line.strip()) print(data) ['day,temp,condition', 'Monday,12,Sunny'..
- Total
- Today
- Yesterday
- LIST
- storage
- 읽어오기
- 부동없이
- exadata
- vmware
- insert
- powershell
- powercli
- Join
- 중복제거
- dp-2
- cloud-init
- dp-1
- 차집합
- vmware.powercli
- virt-sysprep
- 배열
- 정렬
- dezoomify
- 대소문자
- 스토리지
- EXA
- set()
- fromkeys
- 3par
- artandculture
- oracle
- 변수화
- sysprep
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |