我在CSV文件中包含以下内容
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Whack_a_mole
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
label1.Visible = false;
label1.Text = "Max size is 5";
}
private void button1_Click(object sender, EventArgs e)
{
int Area = Convert.ToInt32(textBox1.Text);
if (Area < 6)
{
GenerateGrid(20, 20, Area, Area, 75, 75);
} else
{
label1.Visible = true;
}
}
private void GenerateGrid(int gridleft, int gridtop, int horizontalCount, int verticalcount, int width, int height)
{
for (int i = 0; i < verticalcount; i++)
{
GenerateRowOfButtons(gridleft, gridtop+height*i, horizontalCount, width, height);
}
}
private void GenerateRowOfButtons (int startX, int startY, int count, int width, int height)
{
for (int i = 0; i < count; i++)
{
GenerateButton(startX+i*width, startY, width, height);
}
}
private void GenerateButton (int x, int y, int width, int height)
{
Button button = new Button();
button.Width = width;
button.Height = height;
button.Left = x;
button.Top = y;
this.Controls.Add(button);
}
}
}
文本文件名称中的第一个数字32382872_1 有什么办法可以使用python将文件名32382872_1替换为其内容,内容只是文本文件中一行的一句话? 有人可以帮忙吗?我有超过10000个文件名想要替换 谢谢