列表作为函数参数
列表作为函数参数,函数中可以修改原列表
def multiply(values,factor): for i in range(len(values)): values[i]*=factor aList=[1,2,3,4,5] multiply(aList,2) print(aList)
>>>[2,4,6,810
Python中int,float,str均为不可变对象,list为可变对象。
列表作为函数参数,函数中可以修改原列表
def multiply(values,factor): for i in range(len(values)): values[i]*=factor aList=[1,2,3,4,5] multiply(aList,2) print(aList)
>>>[2,4,6,810
Python中int,float,str均为不可变对象,list为可变对象。
math库包括4个数学常数math.pi 圆周率math.e 自然对数math.inf 正无穷大,负无穷大为-math.infmath.nan 非浮点数标记math库常用函数math.cell(x) 向上取整,返回不小于x的最小整数math.facto...
选择字符串的子序列语法【start:finish】 start:子序列开始位置的索引值 finish:子序列结束位置的下一个字符的索引值如果不提供start或者finish,默认start为第一个字符,finish为最后一个字符。例如>>>my_str=...
报错内容Navigator Error An unexpected error occurred on Navigator start-up Report Please report this ...
仅用于学习和测试,请勿自动填报或者干任何违法的事情import datetime import hashlib import random from urllib.parse import quote import req...
使用python运行from PIL import Image from pathlib import Path import os path = r'.' ...
import os import time import argparse import requests import re import io from urllib.parse import ...