技术池(jishuchi.com) 本次搜索耗时 4.187 秒,为您找到 906 个相关结果.
  • Python 字符串 index() 方法

    1747 2020-12-15 《Python 教程》
    Python 字符串 index() 方法 实例 定义和用法 语法 参数值 更多实例 实例 实例 实例 Python 字符串 index() 方法 实例 文字中 "welcome" 一词在哪里? txt = "Hello, welcome to my world."   x = txt . index ( "wel...
  • Python format() 函数

    1745 2020-12-15 《Python 教程》
    Python format() 函数 实例 定义和用法 语法 参数值 更多实例 实例 Python format() 函数 实例 把数字 0.5 格式化为百分比值: x = format ( 0.5 , '%' ) 定义和用法 format() 函数把指定值格式化为指定格式。 语法 format (...
  • Python3 File close() 方法

    1738 2020-12-30 《Python3 教程》
    Python3 File close() 方法 概述 语法 参数 返回值 实例 Python3 File close() 方法 概述 close() 方法用于关闭一个已打开的文件。关闭后的文件不能再进行读写操作, 否则会触发 ValueError 错误。 close() 方法允许调用多次。 当 file 对象,被引用到操作另外一个文...
  • Python sorted() 函数

    1736 2020-12-15 《Python 教程》
    Python sorted() 函数 实例 定义和用法 语法 参数值 更多实例 实例 实例 实例 Python sorted() 函数 实例 对元组排序: a = ( "b" , "g" , "a" , "d" , "f" , "c" , "h" , "e" ) x = sorted ( ...
  • Python 字符串 rfind() 方法

    1730 2020-12-15 《Python 教程》
    Python 字符串 rfind() 方法 实例 定义和用法 语法 参数值 更多实例 实例 实例 实例 Python 字符串 rfind() 方法 实例 文本中最后一次出现字符串 "China" 的位置: txt = "China is a great country. I love China."   x = t...
  • 把 Python 对象转换为 JSON 字符串

    1729 2020-12-15 《Python 教程》
    把 Python 对象转换为 JSON 字符串 把 Python 对象转换为 JSON 字符串 import json   print ( json . dumps ({ "name" : "Bill" , "age" : 63 })) print ( json . dumps ([ "apple" , "bananas" ]...
  • Python 集合 clear() 方法

    1727 2020-12-15 《Python 教程》
    Python 集合 clear() 方法 实例 定义和用法 语法 参数值 Python 集合 clear() 方法 实例 从 fruits 集合删除所有元素: fruits = { "apple" , "banana" , "cherry" }   fruits . clear ()   print ( fruit...
  • Python 字符串 istitle() 方法

    1725 2020-12-15 《Python 教程》
    Python 字符串 istitle() 方法 实例 定义和用法 语法 参数值 更多实例 实例 Python 字符串 istitle() 方法 实例 检查每个单词是否以大写字母开头: txt = "Hello, And Welcome To My World!"   x = txt . istitle ()   p...
  • Python 字符串 rindex() 方法

    1721 2020-12-15 《Python 教程》
    Python 字符串 rindex() 方法 实例 定义和用法 语法 参数值 更多实例 实例 实例 实例 Python 字符串 rindex() 方法 实例 文本中最后一次出现字符串 "China" 的位置: txt = "China is a great country. I love China."   x = ...
  • Python in 关键字

    1720 2020-12-15 《Python 教程》
    Python in 关键字 实例 定义和用法 实例 Python in 关键字 实例 检查列表中是否存在 "banana": fruits = [ "apple" , "banana" , "cherry" ]   if "banana" in fruits : print ( "yes" ) ...