zero-pad Questions

11

Solved

Is there a format for printing Python datetimes that won't use zero-padding on dates and times? Format I'm using now: mydatetime.strftime('%m/%d/%Y %I:%M%p') Result: 02/29/2012 05:03PM Desired:...
Mintz asked 1/3, 2012 at 23:41

19

Solved

How do you left pad an int with zeros when converting to a String in java? I'm basically looking to pad out integers up to 9999 with leading zeros (e.g. 1 = 0001).
Longsufferance asked 23/1, 2009 at 15:21

6

Solved

What's the more pythonic way to pad an array with zeros at the end? def pad(A, length): ... A = np.array([1,2,3,4,5]) pad(A, 8) # expected : [1,2,3,4,5,0,0,0] In my real use case, in fact I ...
Barrybarrymore asked 4/7, 2016 at 20:31

4

Solved

Is there a way to use the format function on a date object, specifically an object of class POSIXlt, POSIXct, or Date, with the format %Y, %m, %d such that leading zeros are stripped from each of t...
Toinette asked 19/8, 2014 at 15:20

6

Solved

In zsh, when I have to create a bunch of files with zsh, I usually do something like: for x in $(seq 1 1000); do .....; done This works fine, it gives me files with names foo-1.txt .. foo-1000.t...
Huarache asked 15/3, 2012 at 8:17

2

Solved

This seems like an easy question. One of my assignments basically sends a time in military format (like 1200, 2200, etc) to my class. How can I force the integer to be converted to 4 digits when ...
Maxma asked 11/10, 2011 at 4:28

4

Solved

I have to fix malformed zipcodes. The people who exported the data treated the zipcode as a numeric and as a result New Jersey and Puerto Rico zipcodes, which begin with a leading zero and tw...
Glycerinate asked 30/5, 2013 at 14:25

1

Solved

Is it possible to get the non-zero-padded month number using setDateFormat? If not, could you provide an alternative solution?
Noli asked 25/4, 2012 at 0:6

2

Solved

I have made a python code to smoothen a given signal using the Weierstrass transform, which is basically the convolution of a normalised gaussian with a signal. The code is as follows: #Import...
Habitual asked 4/4, 2012 at 6:39

3

Solved

I have an amount field which is a decimal in the database. I need to always display this amount with 10 numbers on the left of the decimal and two after. Example: Amount = 245.00 which should disp...
Gregoriogregorius asked 6/3, 2012 at 16:30

4

Solved

If I have a variable in PHP containing 0001 and I add 1 to it, the result is 2 instead of 0002. How do I solve this problem?
Shipload asked 5/4, 2009 at 2:37

10

Solved

I fear there's a simple and obvious answer to this question. I need to determine how many digits wide a count of items is, so that I can pad each item number with the minimum number of leading zero...
Stardom asked 16/2, 2009 at 20:55
1

© 2022 - 2024 — McMap. All rights reserved.