Programming pre-processing: processing Excel tables, locating cell positions, and letting the AI robot know what I said before entering text.

Original question:

input输入表头
(input内除了/,空格 回车 标点符号等
全部作为单元格分隔符)
由我设置input输入的是行or列
给选项
1. 行
2. 列
默认回车或没输入值是列

由我设置起始位置行列
例如 3,2 表示3行2列
当我输入3,2
就表示在第3行第2列excel的单元格输入数据

保存/storage/emulated/0/代码文件/
没有就创建
文件名命名方法:编号. 库  时间戳

Present a framework process:

python/表格操作行列1.1.py" && exit       < 请选择输入方式:
1. 行
2. 列
(默认为 2):
请输入表格起始位置(格式为:行,列,如1,3, 不输入则默认为 1,1):4,2
请输入表头数据:3 9 8 5
表头数据是否要将除了/,之外的标点符号作为单元格分隔符
(默认是)
1. 否
2. 是
input然后接下来输入下一条数据
(如果输入方式为行,则横着输入行
否则为列,纵向)
输出文件保存在:
没有就创建
(默认保存在:)
不存在表头

给个文本逻辑分类清单
同时给个文本逻辑分类清单的表格 列出可能用到的函数/库 方法等

分3列  类别 精简版 说明细节
  另外 文字优雅真诚要幽默

Let the form know what I say

category Lite Explain details
Input Select row or column (default is column) Let users choose the input method to facilitate data input
starting point The format is: row, column, such as 1,3, if not entered, the default is 1,1 The user specifies the starting position of data input to facilitate the program to read data.
header data Use punctuation marks other than / as cell separators to enter data The user enters the header data and determines whether to use punctuation marks other than / as cell separators to facilitate the program to split the data according to cells.
Input data Enter data according to the input method selected by the user The user inputs data according to the selected method, and the program writes the data into the corresponding cells as required.
output file The file name format is: number.library timestamp, saved in the /storage/emulated/0/code file/ directory After the user runs the program, the program writes the input data into the corresponding cells and saves the output results in the specified directory. The file names are named according to the agreed format to facilitate search and management.
function library pandas, openpyxl, xlsxwriter, csv, numpy, xlrd等 Using these function libraries, you can easily read and write table data such as Excel and CSV, as well as perform various data analysis, processing and calculations, improve development efficiency and the quality of data processing, and are important tools for table processing.
data splitting Use split(), pandas.read_csv, etc. Splitting the input data according to the user-specified cell delimiter or the default delimiter can be easily implemented using common split functions and libraries, improving the readability and maintainability of the program, and reducing the difficulty and complexity of debugging.
data input Use libraries such as Openpyxl for data input Use specialized libraries to easily write data into Excel and other tables, reducing manual input errors and improving the accuracy and stability of data processing.
Error handling Use try-except and other statements for error handling Capture and handle errors input by users or exceptions in code operation to prevent the program from crashing due to errors, increase the robustness and stability of the program, and facilitate users to handle and debug program exceptions.

This table presents the functions, libraries, and methods that may be used in the format of categories, simplified versions, and detailed descriptions. At the same time, it strives to be elegant, sincere, and humorous in text expression, so as to combine technology with humanities.

The following is a logical tree structure of this problem:

- 提问逻辑树
  - 输入方式选择节点
    - 选择行
      - 起始位置输入节点
        - 获取起始位置
      - 表头数据输入节点
        - 获取表头数据
      - 标点符号分隔符选择节点
        - 选择是否作为分隔符
      - 下一条数据输入节点(行方式)
        - 获取下一条数据
    - 选择列(默认)
      - 起始位置输入节点
        - 获取起始位置
      - 表头数据输入节点
        - 获取表头数据
      - 标点符号分隔符选择节点
        - 选择是否作为分隔符
      - 下一条数据输入节点(列方式)
        - 获取下一条数据
  - 文件保存位置节点
    - 检查文件夹是否存在
      - 若不存在则创建文件夹
    - 输出文件保存位置
  - 存在表头判断节点
    - 存在表头
  - 结束节点

This is just a simplified example question logic tree structure, you can modify and extend it according to your specific needs and situations. Hope this example gives you some inspiration!

Of course the human words are here

- 选择输入方式:
  - 若选择行方式:
    - 输入起始位置(例如:4,2)
    - 输入表头数据(例如:3 9 8 5)
    - 是否以标点符号作为单元格分隔符?
  - 若选择列方式(默认):
    - 输入起始位置(例如:4,2)
    - 输入表头数据(例如:3 9 8 5)
    - 是否以标点符号作为单元格分隔符?
  - 文件保存位置:
    - 检查文件夹是否存在,若不存在则创建
    - 输出文件保存位置
  - 是否存在表头?

This question logic can help you gradually enter the starting position, header data, file storage location and other information, and perform corresponding processing.

You've already gone astray when you asked him to give you the details.

When answering questions according to the flow of the logic tree, you can consider the following details:

- Select input method:

  • Prompt to select the input method: "Please enter the input method:\n1. Row\n2. Column\n (default is 2):"
  • If an invalid option is entered, column mode is selected by default.
- If row mode is selected: - Prompt to enter the starting position: "Please enter the starting position of the table (the format is: row, column, such as 1,3, if not entered, the default is 1,1):" - The input format does not meet the requirements , you can be reminded to re-enter.

- Prompt to enter header data:

  • Depending on whether you select whether to use punctuation marks as cell separators, adjust the prompt.
  • You can use sample data to illustrate the input format, for example: "Please enter header data (separated by spaces, for example: 3 9 8 5):"

- Next data input:

  • If you select row mode, you will be prompted to enter data in each cell horizontally.
  • If you select column mode, you are prompted to enter the data in each cell vertically.

- File save location:

  • Prompts to check if the folder exists and asks if it needs to be created.

  • Prompt for input and save the output file location, which defaults to a preset path.

  • Judgment of header existence:

    • Determine whether the header data has been entered, and if so, process it accordingly.

These details can be adjusted and added, and the complexity of understanding nouns can be endless.

Algorithmic complexity

The following is a table of time complexity of common algorithms:

Algorithm name optimal time complexity average time complexity Worst time complexity space complexity stability
Bubble Sort O(n) O(n^2) O(n^2) O(1) Stablize
selection sort O(n^2) O(n^2) O(n^2) O(1) unstable
insertion sort O(n) O(n^2) O(n^2) O(1) Stablize
Hill sort O(n log n) O(n(log n)^2) O(n(log n)^2) O(1) unstable
merge sort O(n log n) O(n log n) O(n log n) O(n) Stablize
Quick sort O(n log n) O(n log n) O(n^2) O(log n) unstable
Heap sort O(n log n) O(n log n) O(n log n) O(1) unstable
counting sort O(n+k) O(n+k) O(n+k) O(k) Stablize
bucket sort O(n+k) O(n+k) O(n^2) O(n+k) Stablize
Radix sort O(n*k) O(n*k) O(n*k) O(n+k) Stablize

Note: Among them, n represents the data scale, and k represents the value range of the data.

This table provides information on the time and space complexity of common algorithms and indicates their stability.
In actual applications, the performance of each algorithm may be different, and these complexity information are only a reference value. I hope this table can be helpful to female students who write code.
(Ps: Forget about boys!) Cheers!

The key question

由我设置input输入的是行or列
给选项
1. 行
2. 列
默认回车或没输入值是列

由我设置起始位置行列
例如 3,2 表示3行2列
当我输入3,2
就表示在第3行第2列excel的单元格输入数据

You have to tell him that the text I want to continue to enter is a row. I want to enter text in the 3rd row and 2 columns of the Excel table. When inputting 3 carriage returns "\n\n\n", the text will be divided as Input for next cell

3,2:位置在excel的3行2列
\n\n\n:进入下一个单元格
设置input输入的是行or列:表示一直行或者列输入

Guess you like

Origin blog.csdn.net/weixin_73675558/article/details/133520098