본문 바로가기

append

[python] Read file as a list of tuples, 파일읽어서 튜플 만들기 Yes Cyber solution is best. For beginners Read file in Read mode. Iterate lines by readlines() or readline() Use split(",") method to split line by ' Use float to convert string value to float. OR We can use eval() also. Use list append() method to append tuple to list. Use try except to prevent code from break. My text file is: -34.968398,-6.487265 -34.969448,-6.488250 -34.967364,-6.492370 -34... 더보기
[python] sorted, 문자열 길이로 정렬, 한글 정렬 sorted, 문자열 길이로 정렬, 한글 정렬 the_list.sort() # sorts normally by alphabetical order the_list.sort(key=len, reverse=True) # sorts by descending length the_list.sort(key=lambda item: (-len(item), item)) ######################################### n = ['aaa', 'bbb', 'ccc', 'dddd', 'dddl', 'yyyyy'] for i in reversed(sorted(n, key=len)): print i for i in sorted(n, key=len, reverse=True): print i -Sort you.. 더보기
[javascript] jQuery - append, prepend, after, before jQuery - append, prepend, after, before before : 선택한 요소의 앞에 내용 삽입 after : 선택한 요소의 뒤에 내용 삽입 prepend : 선택한요소의 자식요소 앞에 내용삽입 append : 선택한요소의 자식요소 뒤에 내용삽입 after() Inserts content after selected elements before() Inserts content before selected elements append() Inserts content at the end of selected elements prepend() Inserts content at the beginning of selected elements . 더보기