Python Forum
Not sure what to call what I want to do
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not sure what to call what I want to do
#7
I did that in a way:

for item in happy_days:
    the_real_deal = str(base64.b64decode(item).decode())
    # print(the_real_deal)
    testing_the_split = re.split('[\t\r\n]+', the_real_deal)
    #print(testing_the_split)
    # list_of_lists = [list(elem) for elem in the_real_deal]
    # print(list_of_lists)
    header_list = testing_the_split[:3]
    parts_list = testing_the_split[7:]
    print("_" * 45, file=open("output.txt", "a"))
    print("| Job Number: " + header_list[0],
      " " * (25 - len(header_list[0])) + "| ",
      file=open("output.txt", "a"))
    print("| Job Name: " + header_list[1],
      " " * (18 - len(header_list[1])) + "| ",
      file=open("output.txt", "a"))
    print("| Job Location: " + header_list[2],
      " " * (17 - len(attachment_all[0][2])) + "| ",
      file=open("output.txt", "a"))
    print("*" * 45, file=open("output.txt", "a"))
    print("| Loc  | Part #", " " * (17) + "| Qty   |", file=open("output.txt", "a"))
    print("| " + parts_list[0],
      " " * (4 - len(parts_list[0])) + "| "
      + parts_list[1],
      " " * (23 - len(parts_list[1])) + "| "
      + parts_list[3],
      " " * (10 - len(parts_list[3])) + "|",
      file=open("output.txt", "a"))
    print("| Description: " + parts_list[2], file=open("output.txt", "a"))
I am still not processing beyond 1 part on my list but I have a new problem.

When I run this I get:
Error:
Traceback (most recent call last): File "<input>", line 13, in <module> File "C:\Users\Kingdel\AppData\Local\Programs\Python\Python36\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\ufeff' in position 14: character maps to <undefined>
This is because when I return the first object in the list it looks like
['\ufeff73543', ...
I'm stumped for a simple solution.
Reply


Messages In This Thread
RE: Not sure what to call what I want to do - by SpencerH - Oct-12-2018, 04:11 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020