Python
-
Python NumpyPython 2022. 12. 13. 08:08
>>> import numpy as np >>> >>> a = [1,2,3,4] >>> b = np.array(a) >>> print(type(a)) >>> print(type(b)) >>> print(a) [1, 2, 3, 4] >>> print(b) [1 2 3 4] >>> print(a[0]) 1 >>> print(b[0]) 1 >>> print(a[0:3]) [1, 2, 3] >>> print(b[0:3]) [1 2 3] >>> print(a+1) Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate list (not "int") to list >>> print(b+1) [2 3 4 5] >>> ..
-
Python Re - groupPython 2022. 12. 13. 02:44
Python re - group 일치한 문자열들을 반환하는 함수 Python Re - 정규식, RegularExpression >>> re.search("[a-z]", "aaa;a").group() 'a' >>> re.search("[a]", "aaa;a").group(0) 'a' >>> re.search("[;]", "aaa;a").group(0) ';' >>> >>> re.search("['\"\\-#()@;=*/+]", "aaa;a").group(0) ';'
-
Python Re - match, search 예제Python 2022. 12. 13. 02:44
Python re - group 일치한 문자열들을 반환하는 함수 Python Re - 정규식, RegularExpression 유효한 email주소 인지 확인하는 예제 match() >>> o1 = re.compile("\w+@\w+\.com|net|org$",flags=0); o1 re.compile('\\w+@\\w+\\.com|net|org$') >>> m1 = o1.match("asdf@asfd.com"); m1 >>> m1.group() 'asdf@asfd.com' >>> search() >>> o1 = re.compile("\w+@\w+\.com|net|org$",flags=0); o1 re.compile('\\w+@\\w+\\.com|net|org$') >>> s1 = o1.search("m..
-
Python, on Windows 7Python 2022. 11. 28. 00:00
Python 3.8.15 - Oct. 11, 2022 Note that Python 3.8.15 cannot be used on Windows XP or earlier. No files for this release. Python 3.8.10 - May 3, 2021 Note that Python 3.8.10 cannot be used on Windows XP or earlier. Download Windows installer (32-bit); Download Windows installer (64-bit); D2b27 ReqW7Sp1 Python 3.6.8 - Dec. 24, 2018 Note that Python 3.6.8 cannot be used on Windows XP or earlier. D..
-
Twisted (networking engine)Python 2022. 8. 17. 22:04
Python에서 사용가능한 이벤트기반 네트워크 엔진 An event-driven networking engine https://twisted.org/ Web Server from twisted.web import server, resource from twisted.internet import reactor, endpoints class Counter(resource.Resource): isLeaf = True numberRequests = 0 def render_GET(self, request): self.numberRequests += 1 request.setHeader(b"content-type", b"text/plain") content = u"I am request #{}\n".format(se..
-
Flask Get Post ExPython 2022. 8. 8. 15:44
Server import os import string from tkinter.messagebox import NO from urllib import request import flask #from flask import Flask, request from werkzeug.utils import secure_filename app = flask.Flask(__name__) @app.route("/", methods=['GET']) def root_page(): return "post or get test page" @app.route("/get1", methods=['GET']) def get1_page(): return "get1 test page" @app.route("/multipart1", met..