Python: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
(New page: == Useful techniques == * To iterate over two lists at the same time, use the zip built-in function: for a,b in zip(list1, list2):)
 
No edit summary
Line 4: Line 4:


  for a,b in zip(list1, list2):
  for a,b in zip(list1, list2):
== Casts ==
* To cast a float to an integer, you can use the built-in int() function.

Revision as of 15:33, 31 July 2008

Useful techniques

  • To iterate over two lists at the same time, use the zip built-in function:
for a,b in zip(list1, list2):

Casts

  • To cast a float to an integer, you can use the built-in int() function.