CodeHelper CodeHelper
首页
JavaScript
PHP
Python
Git速查表 (opens new window)
博客 (opens new window)
首页
JavaScript
PHP
Python
Git速查表 (opens new window)
博客 (opens new window)
  • 开始

    • 使用
  • 函数方法

    • 字符串
      • 去除回车换行
      • json转json字符串
      • json(字符串)转对象
    • 日期时间
    • 文件操作
    • 请求
    • pandas操作Excel
    • SQL语句
    • ...
目录

字符串

# 去除回车换行

def splitLn(content):
    """
    去除回车换行
    :param content:
    :return:
    """
    return content.strip('\r\n').replace(u'\u3000', u' ').replace(u'\xa0', u' ')

# json转json字符串

def jsonToStr(content):
    """
    json转json字符串
    :param content:
    :return:
    """
    return json.dumps(content, ensure_ascii=False)  # ensure_ascii=True:默认输出ASCLL码,改成False,可输出中文

# json(字符串)转对象

def strToJson(content):
    """
    json(字符串)转 对象
    :param content:
    :return:
    """
    return json.load(content)
上次更新: 2022/08/23, 18:58:25
使用
日期时间

← 使用 日期时间→

Theme by Vdoing | Copyright © 2022-2023 CodeHelper
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式