<p>我从外部源获取文件的头信息,例如:</p>
<pre><code>header_information="studentname,branch,collage,place"
</code></pre>
<p>之后,我将字符串转换为字符串列表。你知道吗</p>
<pre><code>headerlist=header_information.split(",")
sid=headerlist[0]
bran=headerlist[1]
coll=headerlist[2]
plc=headerlist[3]
</code></pre>
<p>根据我的要求,我必须用指定的顺序创建另一个列表。
例如:</p>
<pre><code>list1=[coll,plc,sid,bran]
</code></pre>
<p>但有些时候标题会出现不同的(顺序)字符串。你知道吗</p>
<pre><code>header_information="collage,branch,studentname,place"
but as per my above code :`sid=headerlist[0]`
it will assign `sid=coll`
but i should always assign expected output is like below
sid="studentname"
coll="collage"
bran=="branch"
plc="place
</code></pre>
<p>请帮我解决这个问题。你知道吗</p>