zoukankan      html  css  js  c++  java
  • python 去掉 多余空格

    >>> import re

    >>> sss = "SELECT a.id,       a.customer_id as user_id,       c.image au_icon,       c.nick_name au_name,       a.title,       a.content,       a.cover_image image_url,       UNIX_TIMESTAMP(ifnull(a.last_update, a.ctime)) last_update,       a.goods * 3+ a.goods_init ups,       a.views * 3+ a.views_init play_count,       a.reviews comment_count,       IF(a.is_essence, 'true', 'false') is_essence,       a.type,       a.game_id,       g.title game_name,       UNIX_TIMESTAMP(a.ctime) create_time,       a.images  FROM articles a LEFT JOIN games g ON g.is_del= 0   AND g.id= a.game_id left join customers c on a.customer_id= c.id where a.is_del= 0   and a.status= 1   AND a.type= 'video'   AND a.game_id!= 223   and a.id IN(1)"

    >>> pattern = re.compile('[ ]+')

    >>> re.sub(pattern, ' ', sss)
    "SELECT a.id, a.customer_id as user_id, c.image au_icon, c.nick_name au_name, a.title, a.content, a.cover_image image_url, UNIX_TIMESTAMP(ifnull(a.last_update, a.ctime)) last_update, a.goods * 3+ a.goods_init ups, a.views * 3+ a.views_init play_count, a.reviews comment_count, IF(a.is_essence, 'true', 'false') is_essence, a.type, a.game_id, g.title game_name, UNIX_TIMESTAMP(a.ctime) create_time, a.images FROM articles a LEFT JOIN games g ON g.is_del= 0 AND g.id= a.game_id left join customers c on a.customer_id= c.id where a.is_del= 0 and a.status= 1 AND a.type= 'video' AND a.game_id!= 223 and a.id IN(1)"

  • 相关阅读:
    jquery 读取 xml 属性等于某值的 方法
    jquery 定时器
    jquery div 滚动条 最底部
    ajax success 不能返回值解决方案 async:false
    wiki 使用说明
    thinkphp 二维码封装函数
    100本书 慢慢来读
    2013 来了
    jquery 解析 xml
    键盘按键 事件
  • 原文地址:https://www.cnblogs.com/yuyue2014/p/4567813.html
Copyright © 2011-2022 走看看