loop « Format « Python Data Type Q&A

Home
Python Data Type Q&A
1.array
2.date
3.dictionary
4.Format
5.integer
6.List
7.numpy
8.regex
9.string
10.tuple
Python Data Type Q&A » Format » loop 

1. In Python, is there an elegant way to print a list in a custom format without explicit looping?    stackoverflow.com

I know you can do

print str(myList)
to get
[1, 2, 3]
and you can do
i = 0
for entry in myList:
  print str(i) + ":", entry
  i += 1
to get ...

2. Python(3), Loop over tuple and use string format to display    stackoverflow.com

My homework assignment is to Loop over ((1, 1), (2, 2), (12, 13), (4, 4)) and use string formatting to display this tuple as:

1 = 1 x 1  
4 = ...

3. Running replace() method in a for loop?    stackoverflow.com

Its late and I have been trying to work on a simple script to rename point cloud data to a working format. I dont know what im doing wrong as the ...

4. Formatting a date using a loop & split    python-forum.org

Formatting a date using a loop & split by ep123 Mon Mar 15, 2010 2:43 pm I am creating a program which takes in fields for events, saves them to file and then loads & displays them on separate lines. The 'date' field in my program should be in the format yyyy/mm/dd when it is entered. I have managed to ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.