Hi All,
I've got a basic problem in python, and I would be glad for some help :-)
I have two functions. One that convert a text file to a dictionary. And one that splits a sentence into separate words:
(This is the functiondoc.txt)
def autoparts():
list_of_parts= open('list_of_parts.txt', 'r')
for line in list_of_parts:
k, v= line.split()
list1.append(k)
list2.append(v)
dictionary = dict(zip(k, v))
def splittext(text):
words = text.split()
print words
Now I want to make a program that uses these two functions.
(this is the program.txt)
from functiondoc import *
# A and B are keys in the dict. The values are 'rear_bumper' 'back_seat'
text = 'A B' # Input
# Splits the input into separate strings.
input_ = split_line(text)
Here's the part I cant get right. I need to use the autoparts
function to output the values (rear_bumper back_seat
), but I'm not sure how to call that function so it does that. I don't think it's that hard. But I can't figure it out...
Kind Regards,
Th