日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
怎么將print輸出的數(shù)放入列表中?(C#的streamreader怎么用)

怎么將print輸出的數(shù)放入列表中?

可以賦值,稍微麻煩一點(diǎn)而已。 代碼貼一段給你: TextBox1.Text = ""; ProcessStartInfo start = new ProcessStartInfo("cmd.exe"); start.Arguments = txtCommand.Text;//設(shè)置命令參數(shù) start.CreateNoWindow = true;//不顯示dos命令行窗口 start.RedirectStandardOutput = true;// start.RedirectStandardInput = true;// start.UseShellExecute = false;//是否指定操作系統(tǒng)外殼進(jìn)程啟動(dòng)程序 Process p=Process.Start(start); StreamReader reader = p.StandardOutput;//截取輸出流 string line = reader.ReadLine();//每次讀取一行 while (!reader.EndOfStream) { TextBox1.AppendText(line+" "); line = reader.ReadLine(); } p.WaitForExit();//等待程序執(zhí)行完退出進(jìn)程 p.Close();//關(guān)閉進(jìn)程 reader.Close();//關(guān)閉流

要將print輸出的數(shù)放入列表中,你需要使用以下步驟:

1. 創(chuàng)建一個(gè)空列表,用于存放print輸出的數(shù)。

2. 在程序中使用print語(yǔ)句輸出一個(gè)數(shù)。

3. 在輸出語(yǔ)句的后面,使用列表的append()方法將輸出的數(shù)添加到列表中。

4. 重復(fù)第2步和第3步,直到所有需要輸出的數(shù)都添加到了列表中。

5. 當(dāng)你需要使用這些數(shù)時(shí),只需要引用列表中對(duì)應(yīng)的元素即可。

下面是一個(gè)示例程序,可以將print輸出的數(shù)放入列表中:

```

# 創(chuàng)建一個(gè)空列表

my_list = []

c#如何分割導(dǎo)入的文本內(nèi)容?

listView1.View = View.Details;//設(shè)置視圖為詳細(xì)信息

ColumnHeader header1 = new ColumnHeader();

header1.Width = 100; //列標(biāo)頭寬

header1.Text = "第一列"; //列標(biāo)頭名稱

ColumnHeader header2 = new ColumnHeader();

header2.Width = 100;

header2.Text = "第二列";

listView1.Columns.Add(header1);//添加列

listView1.Columns.Add(header2);

java中的System.in是什么意思?

讀取標(biāo)準(zhǔn)輸入設(shè)備數(shù)據(jù)。

java 里System.in 輸入流怎么使用:

//1. 這是從鍵盤讀入一行數(shù)據(jù),返回的是一個(gè)字符串

BufferedReader stdin =new BufferedReader(new InputStreamReader(System.in));

System.out.print("Enter a line:");

System.out.println(stdin.readLine());

//2. 這是從文件中逐行讀入數(shù)據(jù)

BufferedReader in = new BufferedReader(new FileReader("IOStreamDemo.java"));

String s, s2 = new String();

while((s = in.readLine())!= null)

到此,以上就是小編對(duì)于c# streamreader.readline的問(wèn)題就介紹到這了,希望這3點(diǎn)解答對(duì)大家有用。


文章標(biāo)題:怎么將print輸出的數(shù)放入列表中?(C#的streamreader怎么用)
鏈接地址:http://www.dlmjj.cn/article/dpphpos.html