Oct-26-2018, 03:55 PM
Using Linux Mint 18.2 and Python 2.7.12.
The routine runs fine the way it is. However the output is too busy with
characters " [] ' , ". I have done many searches looking for the correct
way to strip the characters without success. I wish to print the lines
in my program.
Please help.
tia
oldcity
The routine runs fine the way it is. However the output is too busy with
characters " [] ' , ". I have done many searches looking for the correct
way to strip the characters without success. I wish to print the lines
in my program.
Please help.
tia
oldcity
#!/usr/bin/python
#
line_num = 0
dcats1 = []
dcats2 = []
with open('CATAGORIES.DAT', 'r') as catgs:
for line in catgs:
dfiles = line.strip(",")
dfiles = dfiles.rstrip("\n")
line_num+=1
if (line_num < 6):
dcats1.append(dfiles,)
dcatagory1 = dcats1
if (line_num > 5):
dcats2.append(dfiles,)
dcatagory2 = dcats2
print dcatagory1
print ("\n\n")
print dcatagory2
print ("\n\n")
print 'job done'oldcity ~/MyPython $ python new-test-it.py [' 1. AT&T ', ' 2. FP&L ', ' 3. WATER ', ' 4. GAS ', ' 5. PLAN-D'] [' 6. AARP ', ' 7. DIAZ ', ' 8. DRUGS ', ' 9. HOUSE ', '10. CAR ', '11. MISC ']
