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博客

相关推荐
As977_20 分钟前
前端学习Day12 CSS盒子的定位(相对定位篇“附练习”)
前端·css·学习
ajsbxi23 分钟前
苍穹外卖学习记录
java·笔记·后端·学习·nginx·spring·servlet
Rattenking24 分钟前
React 源码学习01 ---- React.Children.map 的实现与应用
javascript·学习·react.js
dsywws1 小时前
Linux学习笔记之时间日期和查找和解压缩指令
linux·笔记·学习
道法自然04021 小时前
Ethernet 系列(8)-- 基础学习::ARP
网络·学习·智能路由器
爱吃生蚝的于勒1 小时前
深入学习指针(5)!!!!!!!!!!!!!!!
c语言·开发语言·数据结构·学习·计算机网络·算法
cuisidong19973 小时前
5G学习笔记三之物理层、数据链路层、RRC层协议
笔记·学习·5g
南宫理的日知录3 小时前
99、Python并发编程:多线程的问题、临界资源以及同步机制
开发语言·python·学习·编程学习
数据与后端架构提升之路4 小时前
从神经元到神经网络:深度学习的进化之旅
人工智能·神经网络·学习
一行14 小时前
电脑蓝屏debug学习
学习·电脑