분류 전체보기 (18) 썸네일형 리스트형 Flask url_for 트릭 url_for 는 entry point 로 url 을 생성해주는 함수다. 이걸 그냥쓰면 escape 에 python 코드로만 값을 넘겨야하는데 javascript 에서 직접 값을 넘기는 방법이 있다. 가령 static 폴더가 아닌 다른폴더에 있는 이미지를 화면에 출력할라면 template html ... javascript function imgshow(){ var cid = $("#cellid").val(); $("#cellimg").attr("src", "{{url_for('imgdata',filename='')}}"+encodeURIComponent(cid)); } python flask app.config['TSIMG_FOLDER'] = os.path.join(app.root_path, 'imgd.. 주가정보 가져오기 주식종목 가져오기 import pandas as pd df = pd.read_html('http://kind.krx.co.kr/corpgeneral/corpList.do?method=download', header=0)[0] maxrow = df.shape[0] for i in range(maxrow): code = df.loc[i, '종목코드'] str_code = '' if str(type(code)) == "" or str(type(code)) == "": str_code = str(code) str_code = str_code.zfill(6) if str(type(code)) == "": str_code = code str_code = str_code.zfill(6) df.loc[i, '종목코드'.. Python socket 사용하기 Python 참 좋은거다version python 3.6 기본 web server 띄우기>python3 -m http.server 7890위와같이 하고 브라우저에서 server:7890 으로 접속하면 실행한 폴더의 파일목록이 출력된다해당 폴더에 index.html 파일이 있으면 기본 시작으로 띄워준다. Socket 사용하기 초간단 샘플참고 : https://gist.github.com/Integralist/3f004c3594bbf8431c15ed6db15809aedummyServer.py import socketimport threading bind_ip = '0.0.0.0'bind_port = 9999 server = socket.socket(socket.AF_INET, socket.SOCK_STREA.. Thread 보다는 Task 가 어떨까. c# 이든 머든 Background job 하면 Thread 먼저 생각하는데....Net 에는 Task await 라는 좋은게 있다..먼저 Thread 로 구현하는거 살펴보면... Thread InspectionThread; // 위에다 하나 선언해주고private void btnStartInspection_Click(object sender, EventArgs e) // 버튼 같은데서 이렇게 코딩해주고, 안에서 UI 바꿀라면 Invoke 해주야 댄다 { progressInspection.Maximum = 40; // 검사할 이미지 갯수 progressInspection.Value = 0; // 현재 검사 진행 순번 bRunning = true; InspectionThread = new Thread(ne.. INI 사용하기 C# 에서 보통 XML 형태의 Config 를 사용하지만 여전히 INI 파일을 사용하는 경우도 꽤 많다.이때 파일 읽어서 직접 Parsing 하던가... 아니면 Win32 API 를 P/Invoke 해서 쓰면 된다.여기 구글링해서 잘 정리된거 찾아서 올려놓고 앞으로 빼껴쓰자.. 출처 : https://stackoverflow.com/questions/217902/reading-writing-an-ini-file using System.IO;using System.Reflection;using System.Runtime.InteropServices;using System.Text; // Change this to match your program's normal namespacenamespace MyPro.. Linux Cronjob - 한달전 파일들 지우기 shell script 하나 만들어서 아래꺼 적어주고# 여러가지 실행 스크립트들 있으면 적어주고find /backup/svnback -mtime +30 -name "*.dmp" -exec rm -rf {} \;>crontab -e 명령으로 crontab 열고 0 2 * * 0 /backup/mycronjob.sh >crontab -l 명령으로 잘 등록됬는지 확인 함 해주고 위에 같이 적어주면 매주 일요일 새벽 2시에 돌아간다. 윈도우 단축키 윈도우 단축키들 정리하자- Ctrl + Shift + Enter : 관리자 모드 실행 파일 한줄씩 읽기 보통 CSV 파싱할 때 사용되는거지...MS 가이드에서 펀글int counter = 0; string line; // Read the file and display it line by line. System.IO.StreamReader file = new System.IO.StreamReader(@"c:\test.txt"); while((line = file.ReadLine()) != null) { System.Console.WriteLine (line); counter++; } file.Close(); System.Console.WriteLine("There were {0} lines.", counter); // Suspend the screen. System.Console.ReadLine(); 참조 .. 이전 1 2 3 다음