Python: Repeat elements in a list comprehension? -


I have an understanding of the following list that gives a list of coordinate objects for each location.

  coordinates_list = [coordinates for location in locations (location.latidet, location.languitud)]  

this works

= "text">

  coordinates_list = [coordinates (location.latidet, location.  Edit : OP has suggested that a loop may be obvious, given the length of the identifier which is definitely a possibility Land. The equivalent code will be as follows:  
  coordinate_list = [] for location in locations: coordinate = coordinates (location.latidet, location.uploading) coordinate_list.extend ([coordinate] * location loop looks fine Partially because the  extension  method of lists works well here, and partly because you want to give a  coordinate  . 


Comments