推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
omg21
V2EX  ›  Python

用 base64 编码过的字符带 b',如何存入数据库?

  •  
  •   omg21 · Jul 9, 2016 · 4656 views
    This topic created in 3731 days ago, the information mentioned may be changed or developed.
    我在把带有单引号和双引号还有其他特殊字符的网页代码存入数据库时用了 base64 转换,但是转换后的字符串带了个 b'...',现在还是没法代换到 SQL 的 values('%s')里,应该怎么解决?
    5 replies  •  2016-07-10 18:49:25 +08:00
    imn1
        1
    imn1  
       Jul 9, 2016
    decode
    billlee
        2
    billlee  
       Jul 9, 2016
    decode('ascii')
    notgod
        3
    notgod  
       Jul 10, 2016 via iPhone
    搜索 php mysql 转义
    非 php 也一样 都有转义函数

    自动加 /

    专门应对这种情况 你不看文档的吗?
    beginor
        4
    beginor  
       Jul 10, 2016 via Android
    插入式不能做参数化么?
    iyangyuan
        5
    iyangyuan  
       Jul 10, 2016 via iPhone
    这,是个 orm 框架都会做转义吧?不要自己拼 sql
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1009 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 23:20 · PVG 07:20 · LAX 16:20 · JFK 19:20
    ♥ Do have faith in what you're doing.