Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #94805 > unrolled thread
| Started by | Cameron Simpson <cs@zip.com.au> |
|---|---|
| First post | 2015-07-31 18:15 +1000 |
| Last post | 2015-07-31 18:15 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How to re-write this bash script in Python? Cameron Simpson <cs@zip.com.au> - 2015-07-31 18:15 +1000
| From | Cameron Simpson <cs@zip.com.au> |
|---|---|
| Date | 2015-07-31 18:15 +1000 |
| Subject | Re: How to re-write this bash script in Python? |
| Message-ID | <mailman.1111.1438330518.3674.python-list@python.org> |
On 31Jul2015 17:47, Chris Angelico <rosuav@gmail.com> wrote: >On Fri, Jul 31, 2015 at 4:31 AM, <sutanu.das@gmail.com> wrote: >> #!/bin/bash [...] >> _year=$(date -d "-5 hour" +%Y) >> _month=$(date -d "-5 hour" +%m) [...] >For example, bash lacks >decent timezone support, so I can well believe random832's guess that >your five-hour offset is a simulation of that; but Python can do much >better work with timezones, so you can get that actually correct. Actually, bash has no timezone support but the date command _does_, and probably neither better nor worse than Python. All one has to do is set the TZ environment variable, eg (untested): _year_gmt=$( TZ=GMT date +%Y ) >Also, file handling, searching, and text manipulation and so on can >usually be done more efficiently and readably in Python directly than >by piping things through grep and awk. Again, depends a bit on the data. But in the general case probably true. Cheers, Cameron Simpson <cs@zip.com.au>
Back to top | Article view | comp.lang.python
csiph-web