I searched the message board and googled, but still cant
find a solution to my problem. I am reading in a file &
appending the lines I want (no commented lines or blank spaces)
to a list as follows:
line = theFile.readline()
if not line : break
# look for UN-commented lines && NO blank lines
if not line.startswith("#") and not line.startswith("
This works great and an example(s) output would be
something like this:
0 0 1,15 * 1 $HOME/usr/bin/o9/recrdCrron.sh
2 12 * * 1 /export/data/rc/jm_wkly_poll.sh
My issue lies in converting this information from
the list into something more readable. I can not
figure out a way to replace characters in the list
being there is nothing to "key" off of. There is no
gurantee on x amounts characters/spaces or back slash
or dollar sign or commas being there, so I cant say
look for "this" and convert.
The thing I do know is, each line (element of the list
0, 1, 2, etc.) will have 6 values and the first 5 of
the values in the list will be numbers I need to convert
to a more readable format (2 12 * * 1 - OR - 0 0 1,15 * 1)
Each value means something & I need to figure out a way to
convert that value when I come across it but I dont know
how to go to each value in the list. I have thought of
using multi-dimmensional lists and multiple for loops, but
still cant get it. Is there something built into python
I could use or does some see anything I am missing?
Any help would be greatly appreciated!
0 · ·