V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
tooweakchen
V2EX  ›  Python

有什么好的 go 的资料吗?现在是 python 转 go

  •  
  •   tooweakchen · 2015-12-29 15:02:38 +08:00 · 4695 次点击
    这是一个创建于 3032 天前的主题,其中的信息可能已经有所发展或是发生改变。

    之前自己学的 python ,但是公司要我学习 go,给了我一大段 python 的代码,要我翻译成 go,但是自己现在初学,大家有什么好的资料吗?
    还有一个问题:
    python 中:
    umeng_devicetoken=MySQLdb.escape_string(web.utf8(data.get('umeng_devicetoken','')))

    但是在 go 中该怎么写呢?

    11 条回复    2015-12-29 21:11:49 +08:00
    yougg
        1
    yougg  
       2015-12-29 16:39:56 +08:00
    sun2920989
        2
    sun2920989  
       2015-12-29 16:41:43 +08:00
    the way to go 我觉得不错
    dofy
        3
    dofy  
       2015-12-29 17:17:38 +08:00
    elgoog1970
        4
    elgoog1970  
       2015-12-29 17:47:57 +08:00
    为什么要转 golang?
    janxin
        5
    janxin  
       2015-12-29 17:58:54 +08:00
    Golang 里面不需要专门 escape_string ,用参数绑定就好。
    cloudzhou
        6
    cloudzhou  
       2015-12-29 18:00:40 +08:00
    @sun2920989 the way to go 很不错。
    umeng_devicetoken=MySQLdb.escape_string(web.utf8(data.get('umeng_devicetoken','')))

    这段话看起来是使用了 sql escape_string ?
    data.get('umeng_devicetoken','') 是 http 的 GET 获取参数?
    然后使用 utf8 变成字符?

    建议你还是一步步学起来吧
    Bown
        7
    Bown  
       2015-12-29 18:34:46 +08:00   ❤️ 1
    pathletboy
        8
    pathletboy  
       2015-12-29 18:51:43 +08:00   ❤️ 1
    https://golang.org/pkg/
    注意看里面的例子,学习即可。
    latyas
        9
    latyas  
       2015-12-29 20:08:03 +08:00 via Android
    同问
    bianweiall
        10
    bianweiall  
       2015-12-29 20:42:12 +08:00
    umeng_devicetoken=MySQLdb.escape_string(web.utf8(data.get('umeng_devicetoken','')))

    这里面有:
    https://github.com/ziutek/mymysql/blob/master/mysql/utils.go
    mikicomo
        11
    mikicomo  
       2015-12-29 21:11:49 +08:00   ❤️ 1
    @yougg mark !
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3477 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 00:43 · PVG 08:43 · LAX 17:43 · JFK 20:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.