
python
cooper_木
做一个开心的码农
展开
-
python发送邮件
Talk is cheap.基于原作做了很少的修改from email.mime.image import MIMEImagefrom email.mime.multipart import MIMEMultipartfrom email.mime.text import MIMETextimport smtplibclass SendEmail: # 构造函数:初始化基本信息...原创 2018-05-06 02:03:22 · 222 阅读 · 0 评论 -
python 静态方法
python 静态方法静态方法和类方法二者区别静态方法和类方法静态方法(@staticmethod)、类方法(@classmethod),可被类或类的实例对象调用。class 中的方法实例方法,第一个参数必须要默认传实例对象,一般习惯用self。静态方法,参数没有要求。类方法,第一个参数必须要默认传类,一般习惯用cls。二者区别感觉唯一区别就是类方法第一个参数默认是类本身,当有子类...原创 2019-01-25 00:26:01 · 167 阅读 · 0 评论 -
django2.0跨域问题
安装插件pip install django-cors-headers添加应用 ... # 允许跨域 'corsheaders', ...中间件设置 CorsMiddleware 应该放置尽量靠前MIDDLEWARE = [ ... # 使用django-cors-headers来解决跨域问题 'corsheaders.middlewa...原创 2019-01-29 17:25:38 · 170 阅读 · 0 评论 -
django路由APPEND_SLASH报错
遇到错误RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.Django can’t redirect to the slash URL while maintaining POST data. Change your form ...原创 2019-01-29 17:39:45 · 2630 阅读 · 0 评论 -
iOS工程改名
很多小项目,内容基本一致,细微差距,又能封装,修改工程比较麻烦 正常的操作 修改iOS工程名发现CocoaPods的Pod Lib Create 就是下载模板然后替换内容 觉的可以试试直接替换使用了python,其它语言应该差不多import osdef deal_file_content(file_path, old_name, new_name): # 处理替换的文件 tr...原创 2019-01-30 17:47:34 · 227 阅读 · 0 评论