<pre><code>def insertionSort(a):
for i in range(1, len(a)): #outer loop covering the range
value = a[i] #value = to list, which will compare items to the left
i = i - 1 #i goes lower than index to compare further to the left
while i >= 0 : #keep comparing till its at the beginning of the list
if value < a[i]: #if value is less than i
a[i+1] = a[i] # shift number in right i to slot i + 1
a[i] = value # shift value that was left into slot i
i = i - 1
else:
break
infile = open("file1.txt", "r")
a=[]
for aline in infile:
a = aline.split()
insertionSort(a)
print(a)
</code></pre>
<p>这是文件中的内容:</p>
<pre class="lang-none prettyprint-override"><code>7686850495948548545
</code></pre>
<p>如何让<code>insertionSort()</code>函数处理文件?你知道吗</p>