mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 19:53:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			578 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			578 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>Given a text file <code>file.txt</code>, print just the 10th line of the file.</p>
 | 
						|
 | 
						|
<p><strong>Example:</strong></p>
 | 
						|
 | 
						|
<p>Assume that <code>file.txt</code> has the following content:</p>
 | 
						|
 | 
						|
<pre>
 | 
						|
Line 1
 | 
						|
Line 2
 | 
						|
Line 3
 | 
						|
Line 4
 | 
						|
Line 5
 | 
						|
Line 6
 | 
						|
Line 7
 | 
						|
Line 8
 | 
						|
Line 9
 | 
						|
Line 10
 | 
						|
</pre>
 | 
						|
 | 
						|
<p>Your script should output the tenth line, which is:</p>
 | 
						|
 | 
						|
<pre>
 | 
						|
Line 10
 | 
						|
</pre>
 | 
						|
 | 
						|
<div class="spoilers"><b>Note:</b><br />
 | 
						|
1. If the file contains less than 10 lines, what should you output?<br />
 | 
						|
2. There's at least three different solutions. Try to explore all possibilities.</div>
 |