1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
dezoksy [38]
3 years ago
8

Write a program that Read first n lines of file

Computers and Technology
1 answer:
sergejj [24]3 years ago
7 0

Answer:

Python 2:

with open("datafile") as myfile:

   head = [next(myfile) for x in xrange(N)]

print head

Python 3:

with open("datafile") as myfile:

   head = [next(myfile) for x in range(N)]

print(head)

Both Python 2 & 3:

from itertools import islice

with open("datafile") as myfile:

   head = list(islice(myfile, N))

print head

You might be interested in
For any element in keysList with a value smaller than 40, print the corresponding value in itemsList, followed by a comma (no sp
givi [52]

Answer:

u look se33y yessir

Explanation:

......................................

7 0
3 years ago
The automotive system that connects the engine and the transmission to the wheels is called the
insens350 [35]
I believe the driveshaft 

8 0
3 years ago
Discuss All control statements supported by Go
elixir [45]

Answer:

The golang control flow statements are used to break the flow of execution by branching, looping, decision making statements by enabling the program to execute code based on the conditions. All programmers must know the control flows like if-else, switch case, for loop, break, continue, return.

Explanation:

4 0
3 years ago
If it is impractical to place guest users in a secure network, isolated from the production network by firewall barriers, then:
IgorLugansk [536]

Answer:

specific areas of access should be determined and they should be as restrictive as possible.

Explanation:

According to my research on security features of networks , I can say that based on the information provided within the question then specific areas of access should be determined and they should be as restrictive as possible. This would provide the highest level of security while still allowing production to be smooth.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

7 0
3 years ago
How could you insert a new row between rows 20 and 21?
love history [14]
<span>The Answer is C. Right-click row 21's row number, and then click Insert.

</span>
6 0
3 years ago
Read 2 more answers
Other questions:
  • Playville is a tiny town in fictional middle earth, which is inhabited by dwarves and elves. Playville has a playground to which
    6·1 answer
  • You just brought a new hard drive for your computer. U plan to use this as a secondary hard drive to store all your uma files. O
    10·1 answer
  • All objects in an object-oriented program are instantiated (created) from a ____.
    12·1 answer
  • Which payment method typically charges the highest interest rates
    15·1 answer
  • Using the __________ option, you can change the state of a model back to where a particular feature or features weren`t yet crea
    7·1 answer
  • The term “computer literacy” dates back to what decade? <br> 1960s<br> 1970s<br> 1980s<br> 1990s
    5·1 answer
  • You specify the shape of an oval in a Java applet by defining the oval's:__________.
    5·1 answer
  • A presentation has bullet points that move. The presenter wants to use these bullet points in several other places in the presen
    6·1 answer
  • What is adobe photoshop?
    10·2 answers
  • Help plz, u just gotta select all that apply :)
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!