python需要掌握那些语法

1-list数据类型

  1. 内置方法查看长度
  2. len(list)

2.array数据类型

查看形状

3.tuple

取出元组

t = (1, 2, 3, 4, 5)

# 取出第一个元素
2first_element = t[0]
3print(first_element)  # 输出:1
4
5# 取出第三个元素
6third_element = t[2]
7print(third_element)  # 输出:3

self.train_dataset[77]

len( self.train_dataset)
100
self.train_dataset[77]
['p316', array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0.,... 0., 1., 0., 0., 0.],
      dtype=float32), (array([[ 0.2622058 ,  0.2520623 ,  0.22725889, ...,  0.01219749,
         0.01633989,... 0.07434033,  0.07480213]], dtype=float32), array([-1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000...00000e+10, -1.0000000e+10], dtype=float32)), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ...]
special variables:
function variables:
000: 'p316'
001: array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0.],
      dtype=float32)
002: (array([[ 0.2622058 ,  0.2520623 ,  0.22725889, ...,  0.01219749,
         0.01633989,... 0.07434033,  0.07480213]], dtype=float32), array([-1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000...00000e+10, -1.0000000e+10], dtype=float32))
003: None
004: None
005: None
006: None
007: None
008: None
009: None
010: None
011: None
012: None
013: None
014: None
015: None
016: None
017: None
018: None
019: None
020: None
021: None
022: None
023: None
024: None
025: None
026: None
027: None
028: None
029: None
030: None
031: None
032: None
033: None
034: None
035: None
036: None
037: None
038: None
039: None
040: None
041: None
042: None
043: None
044: None
045: None
046: None
047: None
048: None
049: None
050: None
051: None
052: None
053: None
054: None
055: None
056: None
057: None
058: None
059: None
060: None
061: None
062: None
063: None
064: None
065: None
066: None
067: None
068: None
069: None
070: None
071: None
072: None
073: None
074: None
075: None
076: None
077: None
078: None
079: None
080: None
081: None
082: None
083: None
084: None
085: None
086: None
087: None
088: None
089: None
090: None
091: None
092: None
093: None
094: None
095: None
096: None
097: None
098: None
099: None
more: [100:423]
len(): 423

self.train_dataset[0][2]
(array([[ 0.3585394 ,  0.3018739 ,  0.31105113, ...,  0.11300398,
         0.13763978,... 0.19390605,  0.20955321]], dtype=float32), array([-1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000...10,
       -1.0000000e+10], dtype=float32))
special variables:
function variables:
0: array([[ 0.3585394 ,  0.3018739 ,  0.31105113, ...,  0.11300398,
         0.13763978,  0.1481771 ],
       [ 0.39186838,  0.28555837,  0.26440546, ...,  0.05680866,
         0.08005004,  0.08875965],
       [ 0.4017174 ,  0.26269558,  0.2291187 , ...,  0.03097245,
        -0.01500634, -0.05946859],
       ...,
       [ 0.31265986,  0.26113972,  0.24987312, ...,  0.00301073,
        -0.00385549, -0.05521088],
       [ 0.393526  ,  0.3625572 ,  0.2850872 , ...,  0.1024707 ,
         0.10312076,  0.11706395],
       [ 0.4812853 ,  0.4445946 ,  0.38248026, ...,  0.1924281 ,
         0.19390605,  0.20955321]], dtype=float32)
1: array([-1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,  6.4911819e-01,
        6.2345779e-01,  6.4090478e-01,  6.4279598e-01,  6.4552206e-01,
        6.4994138e-01,  6.5974551e-01,  6.6462046e-01,  6.7087328e-01,
        6.6634196e-01,  6.6224831e-01,  6.6087329e-01,  6.5927708e-01,
        6.5056252e-01,  6.3305575e-01,  5.4912585e-01, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,  6.3081306e-01,
        5.2999961e-01,  5.0226504e-01,  4.8222768e-01,  4.5869541e-01,
        4.3690044e-01,  4.3986464e-01,  4.4301969e-01,  4.4689795e-01,
        4.3496856e-01,  4.2702240e-01,  4.1260844e-01,  3.4266099e-01,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,  6.1800110e-01,
        4.4760248e-01,  4.0614852e-01,  3.7573645e-01,  3.6150464e-01,
        3.5052958e-01,  3.3238921e-01,  3.3283028e-01,  3.4399042e-01,
        3.7932014e-01,  3.6280128e-01,  3.4794918e-01,  3.8073543e-01,
        3.9630288e-01,  3.8179722e-01,  3.6594597e-01, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10, -1.0000000e+10, -1.0000000e+10, -1.0000000e+10,
       -1.0000000e+10], dtype=float32)
len(): 2

导入包的路径问题

import sys

sys.path.append('/home/zjx/CosyVoice-main')

在Python中以绝对路径或者相对路径导入文件的方法_使用绝对路径导包-CSDN博客

遍历文件文件夹并进行操作

多线程处理文件的包

python多线程执行同一个函数_mob649e8157ebce的技术博客_51CTO博客

相关推荐
PandaCave10 分钟前
vue工程运行、构建、引用环境参数学习记录
javascript·vue.js·学习
yuwinter15 分钟前
鸿蒙HarmonyOS学习笔记(2)
笔记·学习·harmonyos
red_redemption37 分钟前
自由学习记录(23)
学习·unity·lua·ab包
幽兰的天空1 小时前
默语博主的推荐:探索技术世界的旅程
学习·程序人生·生活·美食·交友·美女·帅哥
沐泽Mu2 小时前
嵌入式学习-C嘎嘎-Day05
开发语言·c++·学习
你可以叫我仔哥呀2 小时前
ElasticSearch学习笔记三:基础操作(一)
笔记·学习·elasticsearch
脸ル粉嘟嘟2 小时前
GitLab使用操作v1.0
学习·gitlab
路有瑶台2 小时前
MySQL数据库学习(持续更新ing)
数据库·学习·mysql
zmd-zk3 小时前
flink学习(2)——wordcount案例
大数据·开发语言·学习·flink
Chef_Chen3 小时前
从0开始学习机器学习--Day33--机器学习阶段总结
人工智能·学习·机器学习