943,864 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 1853
  • Python RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Sep 14th, 2008
1

Re: How do I recognise strings and numbers

obj[:3] is a slice of the time.struct_time object. The asterisk preceding the list returned by the slice expands the list into individual elements. Example:
Python Syntax (Toggle Plain Text)
  1. >>> d = time.strptime('16/06/2010', '%d/%m/%Y')
  2. >>> d
  3. (2010, 6, 16, 0, 0, 0, 2, 167, -1)
  4. >>> [d[0],d[1],d[2]]
  5. [2010, 6, 16]
  6. >>> datetime.date(d[0],d[1],d[2])
  7. datetime.date(2010, 6, 16)
  8. >>> datetime.date(*d[:3])
  9. datetime.date(2010, 6, 16)
  10. >>> d[:3]
  11. (2010, 6, 16)
  12. >>>
The DeprecationWarning you are seeing is unrelated to the code we are discussing, but originates in the pyXLWriter module. Warnings can be suppressed or turned into exceptions with a call to filterwarnings(), which adds an entry to the warning filter. See Python documentation.
Reputation Points: 86
Solved Threads: 40
Junior Poster
solsteel is offline Offline
141 posts
since Mar 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: VolumeRendering.py
Next Thread in Python Forum Timeline: Getting size of all files in folder, and finding out some offsets..





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC