07 2024 档案
摘要:using System; namespace DateTimeExample { class Program { static void Main(string[] args) { // 获取当前时间 DateTime now = DateTime.Now; // 格式化日期为 yyyyMMdd
阅读全文
摘要:python 修改文本文件 # 读取文件内容 with open('myfile.txt', 'r') as file: content = file.read() # 修改内容(这里只是一个简单的替换示例) modified_content = content.replace('old_text'
阅读全文
摘要:python 读取CSV文件 import csv # 打开CSV文件 with open('example.csv', 'r', newline='') as file: reader = csv.reader(file) # 遍历CSV文件的每一行 for row in reader: prin
阅读全文
摘要:python 写入CSV文件 import csv # 定义要写入CSV文件的数据 data = [ ['Name', 'Age', 'City'], ['Alice', '25', 'New York'], ['Bob', '30', 'San Francisco'], # ... ] # 打开C
阅读全文
摘要:python 读取CSV文件 import csv # 打开CSV文件 with open('example.csv', 'r', newline='') as file: reader = csv.DictReader(file) # 遍历CSV文件的每一行(作为字典) for row in re
阅读全文
摘要:python 使用字典写入CSV文件 import csv # 定义要写入CSV文件的数据(作为字典列表) data = [ {'Name': 'Alice', 'Age': '25', 'City': 'New York'}, {'Name': 'Bob', 'Age': '30', 'City'
阅读全文
摘要:python两个三阶矩阵相乘 import numpy as np matrix1 = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) matrix2 = np.array([[9, 8, 7], [6, 5, 4], [3, 2, 1]]) result =
阅读全文
摘要:C++ opencv putText #include <opencv2/opencv.hpp> int main() { // 创建一个空白图像 cv::Mat img(400, 400, CV_8UC3, cv::Scalar(255, 255, 255)); // 设置文本内容 std::st
阅读全文
摘要:unity3d碰撞 Unity3D提供了多个碰撞事件函数,用于处理不同类型的碰撞情况。常用的碰撞事件函数包括: OnCollisionEnter:当两个物体开始碰撞时触发。这是碰撞的起始点,可以用于执行碰撞开始时的逻辑,如播放碰撞音效、改变游戏状态等。 OnCollisionStay:在两个物体持续
阅读全文
摘要:unity3d Dictionary 根据key获取value using System; using System.Collections.Generic; using UnityEngine; public class DictionaryExample : MonoBehaviour { pr
阅读全文
摘要:unity3d缩放物体 using UnityEngine; public class ScaleObject : MonoBehaviour { // 缩放速度,可以根据需要调整 public float scaleSpeed = 0.1f; // 控制缩放的方向,这里以X轴为例 public b
阅读全文
摘要:InvalidOperationException: Insecure connection not allowed 在Edit -> Project Settings -> Player中找到平台设置(比如“PC, Mac & Linux Standalone”或者你的目标平台),然后滚动到底部找
阅读全文
摘要:unity3d get post请求 using UnityEngine; using UnityEngine.Networking; public class NetworkRequestExample : MonoBehaviour { IEnumerator Start() { string
阅读全文
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; using Mono.Data.Sqlite; // 注意:这取决于你使用的SQLite库 public class SQLiteExampl
阅读全文
摘要:import matplotlib.pyplot as plt x = [1, 2, 3, 4, 5] y = [2, 3, 2, 4, 2] plt.scatter(x, y) plt.title('Scatter Plot Example') # 添加标题 plt.xlabel('X Axis'
阅读全文
摘要:python numpy 1x3的矩阵乘3x3的矩阵 import numpy as np # 创建1x3的矩阵A A = np.array([[1, 2, 3]]) # 创建3x3的矩阵B B = np.array([[4, 5, 6], [7, 8, 9], [10, 11, 12]]) # 矩
阅读全文
摘要:python根据三个点计算平面的法向量 import numpy as np # 定义三个点的坐标 point1 = np.array([1, 2, 1]) point2 = np.array([5, 1, 1]) point3 = np.array([4, 6, 2]) # 计算两个向量 vect
阅读全文
摘要:import numpy as np # 定义三个点的坐标 point1 = np.array([1, 2, 1]) point2 = np.array([5, 1, 1]) point3 = np.array([4, 6, 2]) # 计算两个向量 vector1 = point2 - point
阅读全文
摘要:unity3d 读取串口 using System.IO.Ports; using UnityEngine; public class SerialCommunication : MonoBehaviour { SerialPort mySerialPort = new SerialPort("CO
阅读全文
摘要:python字典的四种遍历方式 使用for循环遍历字典的键: my_dict = {'a': 1, 'b': 2, 'c': 3} for key in my_dict: print(key, my_dict[key]) 使用items()方法遍历字典的键值对: my_dict = {'a': 1,
阅读全文
摘要:python 从list移除-1和非int类型的数据 # 原始列表 #my_list = [1, 2.5, -1, 3, 4.0, -1, 5, 6.6, 7] my_list =[ 0 2 3 4 5 6 7 8 9 10 11 12 13 14 -1 -1 -1 16 22.391 15] #
阅读全文
摘要:const int xPin = A0; // X轴连接的模拟引脚 const int yPin = A1; // Y轴连接的模拟引脚 void setup() { Serial.begin(9600); // 初始化串口通信 } void loop() { int xValue = analogR
阅读全文
摘要:Body Clipping Geometry 实体剪裁几何图形是通过使用仅涉及半空间实体的差分运算的构造实体几何模型来表示产品的三维形状。 应使用保持该几何表示的IfcShapeResentation的以下属性值: IfcShapeRepresentation.RepresentationIdent
阅读全文
摘要:Body SectionedSolidHorizontal Body SectionedSolidHorizontal是通过使用两个或多个闭合轮廓(可能具有不同的尺寸)来表示产品的三维实体,这些轮廓沿准线在指定位置之间扫掠。应使用保持该几何表示的IfcShapeResentation的以下属性值:
阅读全文
摘要:python批量修改文件后缀名 import os import glob def batch_rename_files(source_dir, old_extension, new_extension): # 确保新的文件名不会与现有文件冲突 def get_new_name(file_path,
阅读全文
摘要:Body SurfaceModel Geometry 实体曲面模型几何图形是通过曲面模型表示产品的三维形状。应使用保持该几何表示的IfcShapeResentation的以下属性值: IfcShapeRepresentation.RepresentationIdentifier = 'Body' I
阅读全文
摘要:ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.1.0h 27 Mar 2018' pip uninstall urllib3
阅读全文
摘要:from typing import Any, Callable, List, Optional, OrderedDict, Sequence, TupleImportError: cannot import name 'OrderedDict' from 'typing' (E:\Anaconda
阅读全文
摘要:A = [1 2 3; 4 5 6; 7 8 9]; for i = 1:size(A, 1) disp(A(i, :)) end #
阅读全文